Source code after the jump.
Applied to a single button. Frame 1 shows that sound is on, and frame 2 shows that it’s off.
sound_mc.buttonMode = true
sound_mc.addEventListener(MouseEvent.CLICK,toggleSound)
function toggleSound(e:MouseEvent){
var tempMC:MovieClip = e.currentTarget as MovieClip
var sTransform:SoundTransform = new SoundTransform(1,0);
if(tempMC.currentFrame == 1){
tempMC.gotoAndStop(2)
sTransform.volume = 0;
}else if(tempMC.currentFrame == 2){
tempMC.gotoAndStop(1)
sTransform.volume = 1;
}
SoundMixer.soundTransform = sTransform;
}
If this post helped you in any way, help me in return by clicking on the ad below:






Leave Your Response