all groups > flash actionscript > february 2007 >
You're in the

flash actionscript

group:

Adding sound in actionscript


Adding sound in actionscript geilezeit
2/16/2007 3:25:15 PM
flash actionscript:
Hi. I made a simple Quiz and it enters text "Congratulations" when all 6
questions are correctly answered.
if (score == 6) {
output.text = "Congratulations";
}
That works OK but now I want to a short sound to come up at the same time.
Tried different arrangements of "addSound" but not working yet. Any ideas
please?
Re: Adding sound in actionscript kglad
2/16/2007 3:34:41 PM
try:



// attached to the first frame of your swf you can use:

yourS=new Sound(this);
yourS.attachSound("CongratulationsLinkageID"); // <- assign a linkage id to
your sound and use it here

// in your test to see if all were answered correctly:

if (score == 6) {
output.text = "Congratulations";
yourS.start();
}
Re: Adding sound in actionscript geilezeit
2/16/2007 3:59:46 PM
Re: Adding sound in actionscript kglad
2/16/2007 4:15:35 PM
Re: Adding sound in actionscript simplesite
2/28/2007 10:54:07 PM
Hello, I'm having a problem with the following code (copied from
smartwebby.com), which is suppose to play music.

my_sound = new Sound();
my_sound.attachSound("mix1");
my_sound.start(0,1000);
gotoAndStop("stop");

I have two swf files. The file with the above code works correctly when I
call it directly. However when I load the movie into another movie, the music
doesn't play. I suspect that I need to use _root, _parent or this somewhere in
this code, but I don't know where. Please help me correct this code. Thank
you very much for any help you may provide.
Re: Adding sound in actionscript kglad
2/28/2007 11:01:44 PM
yes, your sound object needs to reference the swf whose library contains the
sound id. same as the original poster:





my_sound = new Sound(this);
my_sound.attachSound("mix1");
my_sound.start(0,1000);
gotoAndStop("stop");
Re: Adding sound in actionscript simplesite
2/28/2007 11:19:41 PM
AddThis Social Bookmark Button