all groups > flash actionscript > october 2004 >
You're in the

flash actionscript

group:

How do I keep a sound play button from playing ten times same sound?



How do I keep a sound play button from playing ten times same sound? Run
10/12/2004 11:54:07 PM
flash actionscript: I have a wav file that is loaded into the library and started using the
sound "load sound from library" behavior. I have buttons that have the stop
and play sound behaviors attached. If I hit the play button repeatedly the
sound doubles then triples upon itself. Is there no way to make it not play
the sound if the sound is already playing? In the Flash MX 2004 Bible it
says that using the start synch option prevents this from happening. But how
do you implement that in this instance?

Thanks

Rick



Re: How do I keep a sound play button from playing ten times same sound? ashish912
10/13/2004 4:21:12 AM
Hi You may call stopAllSounds(); on button before calling the sound play.
or You may use
on button release play sound and button.enabled =false;
Re: How do I keep a sound play button from playing ten times same sound? Run
10/13/2004 10:40:40 PM
Thank you for the reply and solution options, I used the stop prior to play
option you recommended and it works. Although out of curiosity, this doesn't
seem an elegant solution, if they inadvertently hit play they interrupt the
music and it starts to play again from the beginning.

Anyway, thank you for the solution its much appreciated!

Rick




[quoted text, click to view]

Re: How do I keep a sound play button from playing ten times same sound? ashish912
10/14/2004 4:15:29 AM
If you want to pause and then play the sound
Place the sound in a movie clip of as many frames as sound, make it stream,
place the mc on root, play the movieclip on button release stop the movie clip
on pause button again play the mc on play button.
You may look for some examples on net or tr.
Re: How do I keep a sound play button from playing ten times same sound? Run
10/14/2004 1:00:45 PM
Wow that's awesome didn't think of that at all. Thank you so much for the
replies, you have been really great in helping me out.

Thanks again

Rick

AddThis Social Bookmark Button