If you ever need to stop all the sounds playing in flash using ActionScript3, you can do so using the following method.
First include the SoundMixer class:
import flash.media.SoundMixer;
Then to stop the sounds call the stopAll method:
SoundMixer.stopAll();
I am SO THANKFUL for this simple explanation. I’ve spent days trying to figure this out and this was exactly what I needed. The new and improved “stopallSounds” for the AS3 newbs!!
LikeLike
Me too! As the manual didn’t take me anywhere with manuals
obviously at fault then seeing most people looking for a solution
to start and stop sounds failing I was relieved. I would still like
to see a working solution with the SoundChannel object where the
stream may be stopped and resumed.
LikeLike
There is a god… This had me stumped for hours, sounds playing over each other blah blah. These two lines saved my life
LikeLike
Thank you…. this thing works so well……
LikeLike
I flippin love you. Thank God I found this. I’ve been working on this since 2pm and it’s currently 1:26am, that whole time I’ve been trying to figure out how to stop overlapping sound. Thank you, thank you, thank you!!!!!!!!!!
LikeLike
doesn’t stop the FlvPlaybackComponent sound !!!!
LikeLike
does not stop all sounds from embedded sources inside of AIR……lol.. just saying…
LikeLike
Thanks for this but for I am creating a sound on/off button how will i play same sound..
LikeLike
This right here is what I look for when I’m trying to figure stuff out on flash, simple solution that works! Thanks! 😀
LikeLike
Doesn’t work, i have my sounds imported through AS3 i have images, 1 frame long and you can navigate by buttons to the next frames.. i have 5 of those frames, and every frame has his speech. But after i had the 3th frame, and enter the 4th frame the sound of the 3th frame alsof plays, and i can’t stop this.. i don’t know how to stop that sound of the 3th frame 😦
LikeLike
Very easy and elegant solution. Thank you.
LikeLike
I have place the soundMixer.stopAll() to stop the all sound but its not working.
I have loaded the sound dynamically. beside stopAll method is there a any other solution to stop all the sound which are playing in swf.
LikeLike
To mute all sounds use :
SoundMixer.soundTransform = new SoundTransform(0);
To unmute all :
SoundMixer.soundTransform = new SoundTransform(1);
LikeLike
Thank you very much. Exactly what i was looking for. It worked well and saved my day.
LikeLike
Thank you very much for this!!! 😀
LikeLike
Thank you very much. Exactly what i was looking for.
LikeLike
easy methode but effective, thanks bro!
LikeLike
How can it be that simple! Ha Ha. Yeah I am in with everyone else. I wanted to stop all the sounds so I created a for loop with the channel to stop everything added to the channel and that didn’t do any good. Blah! thanks for the 2 lines of code 🙂
LikeLike
does anyone know if this method will also stop all sounds within loaded external .swf files?
LikeLike
work just fine! even with flv component!
LikeLike
I dont often leave replies…
But thank you for a simple solution to a simple problem…
LikeLike
thanks a lot, very useful information!!!
LikeLike
you da man!
LikeLike
Any solution to stop sounds if the user leaves the frame while the sound/video is still buffering? This doesn’t work in that case. Thanks!
LikeLike
when i use this SoundMixer.stopAll(); in my movieclip code to stop mixing each frame containing sound it works but it also stops my bg sound that i have code in my document class.
so please can u help to avoid this problem.
LikeLike
Is their a code to start all sound for a video that is just looping. If I add the code to stop, when the cartoon loops the audio does not restart.
LikeLike