How to make a button in one frame mute all sound/audio in the next frame?
Hello,
I'm trying to create a toggle button that allows users to switch between having music playing or not playing by clicking on a button. However I cannot find a solution that works. Is there anyway for a button to mute all sound from playing in the next frame?
I currently have a start menu whereby music plays - below is the code for that section;
Frame 1 (Main Menu)
stop();
var s:Sound = new JazzyFrenchy_Bensound();
var sc:SoundChannel = s.play();
var s_bool:Boolean = true;
PlayBtn.addEventListener(MouseEvent.CLICK,PlayBtnFrame);
function PlayBtnFrame(e:MouseEvent):void
{
gotoAndStop(2);
}
Frame 2 (Next Menu)
MusicToggle.addEventListener(MouseEvent.CLICK, OffBtnMusic);
function OffBtnMusic(e:MouseEvent):void
{
if(s_bool){
sc.stop();
} else {
sc=s.play();
}
s_bool=!s_bool;
}
OptionsBackButton.addEventListener(MouseEvent.CLICK, BacktoMenu);
function BacktoMenu(e:MouseEvent):void
{
gotoAndStop(3)
if(s_bool){
sc.stop();
} else {
sc=s.play();
}
s_bool=!s_bool;
}
Any responses will be greatly appreciated.
Many thanks.