So I have some audio playing on one of my pages within my Flash movie, but I wanted it to stop playing when the user travels away from the audio page. I know in Actionscript 1 and possibly Actionscript 2 the stopAllSounds() method was available. I soon discovered that in Actionscript 3 you can achieve the same results by:
1. Include the SoundMixer class
// make sure you import this class: import flash.media.SoundMixer;
2. Call the Method within your code:
SoundMixer.stopAll();
Thank you very much. It works.
Regards.
thanks a lot
I have been looking for it.
THAAAAANKSSSS!
thanks a lot too
Thanks, just what I needed
thanks!!!.. works perfect.. (^^,)..
does this apply for video players too?.
Hey, it really works!
Thanks! ^^
Brilliant Thanks
how do you start the sounds again after you have stopped them
Thank you.
Thank you for the info.
so simple and so helpful
Exactly what I needed. Thank you.
This isn’t working for me. I have several SWF files loading into the UILoader. I have placed SoundMixer.stopAll(); inside the button function. When I click the buttons to load the SWF’s once, it works fine, but when I click a second time, all the sounds start playing. It seems this technique will only work if you have one SWF file that has a sound, but not more than one.
Are there any tweaks to this that would correct his problem?
Kary, I did a little search in regards to your issue. Are all your files within the same security sandbox? Here is some info from Adobe:
By default, calling the SoundMixer.stopAll() method stops only sounds in the same security sandbox as the object that is calling the method. Any sounds whose playback was not started from the same sandbox as the calling object are not stopped.
When you load the sound, using the load() method of the Sound class, you can specify a context parameter, which is a SoundLoaderContext object. If you set the checkPolicyFile property of the SoundLoaderContext object to true, Flash Player or Adobe AIR checks for a cross-domain policy file on the server from which the sound is loaded. If the server has a cross-domain policy file, and the file permits the domain of the calling content, then the file can stop the loaded sound by using the SoundMixer.stopAll() method; otherwise it cannot.
Отлично написано. А это все на основе личного опыта?Позвольте полюбопытствовать
great tip. exactly what i was looking for, much appreciated.
nice. simple. functional.
Thank you.
Your page has a good PageRank, was the first one on Google looking for “Stop all Sounds AS3″
Its very nice. But i am using multiple sounds in my presentation, How to stop a particular sound which are loading from external. Kindly please help me.
I can’t thank you enough. It works beautifully.
This doesn’t work 100% of the time. If you exit the video frame before it starts loading, the video will sound in the other frame until you call back the function.
wow..i’ve been seeking for this scrip for long time…i love u dude…hahahah…”im a beginner in flash”..tnx
massive bigups – been banging my head on this for the past couple days, this solution works
- thank you!
Thx a lot …
Great! Spent 2 hours looking for this :/ Works perfectly.
THANKS!!!!!