Stop all sounds permanently in AS3
Posted
by Fahim Akhter
on Stack Overflow
See other posts from Stack Overflow
or by Fahim Akhter
Published on 2010-03-30T11:26:54Z
Indexed on
2010/03/30
11:43 UTC
Read the original article
Hit count: 526
actionscript-3
|flash
Hi,
I have a main swf which has sound on/off buttons. It has many SWF's which are loaded into different placeholders at different time. All of them have different sounds in them. In addition to that there is a music loop going on in the background.
Now, this perticular swf lets call it Father will be placed in some swf later on. What I'm trying to do right now is when the sound off button is pressed turn off all the sounds permanently so the child swf's and their sounds stop too.
I have found a way in AS2 :
global = new Sound( ) //no movie clip target path.
and add the following code to your off button.
on(release){
global.setVolume(0); //mutes all sound
}
and for on button
on(release){ global.setVolume(100); //un mutes all sound }
which ofcourse does not work for AS3. So how can I stop all sounds permanently in AS3? Secondly what if I have one sound (my background loop) which I want to keep going on.
Would be a lot of help, been searching for a while now without a appropriate answer.
© Stack Overflow or respective owner