I’m very much new to Actionscript but I followed a tutorial on creating a mute button which works fine to mute my audio but not to unmute it again after. What’s wrong with my code?
function setMute(vol){
sTransform.volume = vol;
SoundMixer.soundTransform = sTransform;
}
var sTransform:SoundTransform = new SoundTransform(1,0);
var Mute:Boolean = false;
themutebutton.addEventListener(MouseEvent.CLICK,toggleMuteBtn);
function toggleMuteBtn(event:Event) {
if(Mute === false) {
Mute = true;
setMute(0);
} else {
Mute = false;
setMute(1);
}
}
Thanks for the answers, the problem was actually the var muted being initialised to false. I took off the = false and it fixed my problem.
The class was a little complex for me as a beginner and the answer from igor milla works but only if I take the = false away