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

flash actionscript

group:

How to select which sound to play?


How to select which sound to play? bvillanyi
3/28/2007 10:56:48 PM
flash actionscript: I'm just getting started using the JavaScript SetVariable in my web pages to
send information to a Flash movie. One thing I'm stumbling on however is how to
specify which sound clip to play. I have a two layers on my timeline, one with
sound A and the other with sound B. Based on a variable I set in the
JavaScript, I'd like to mute one or play the other, or whatever works to get
one to play and not the other.

Can this be done? If so, how?

Thanks from a Flash newbie,
Beth
Re: How to select which sound to play? kglad
3/28/2007 11:05:51 PM
you have very limited control over sound that's attached to a timeline. you
could work around that by attaching your sounds to two different movieclips,
but you would do better to use the actionscript sound class to control your
sounds.

in the flash help file check actionscript 2.0 language reference and check the
sound class. you just need to create a sound object and read about the
attachSound() and start() methods.

you can then use an if-statement to determine with sound to attach to your
sound object and solve your problem.
Re: How to select which sound to play? bvillanyi
3/28/2007 11:08:43 PM
Re: How to select which sound to play? kglad
3/28/2007 11:10:58 PM
AddThis Social Bookmark Button