I have a button which I want to use to mute audio, which will change to a un-mute icon when it is clicked, and toggle back and forth.
The thing is, its still visible in the stage after my code. The weirdest bit is that if I trace the visibility after I call the function, it actually says that its hidden: but its clearly visible on the stage.
play_pause.addEventListener(MouseEvent.CLICK, change_sound);
function change_sound (e:MouseEvent):void{
fl_NS.soundTransform = muteAudio;
e.target.visible = false;
trace(play_pause.visible);
muted = true;
}
Here are some other things I've tried which didn't work:
play_pause.addEventListener(MouseEvent.CLICK, change_sound);
function change_sound (e:MouseEvent):void{
fl_NS.soundTransform = muteAudio;
play_pause.visible = false;
trace(play_pause.visible);
muted = true;
}
Another version:
play_pause.addEventListener(MouseEvent.CLICK, change_sound);
function change_sound (e:MouseEvent):void{
fl_NS.soundTransform = muteAudio;
play_pause.gotoAndPlay(2);
muted = true;
}
No visual change again. Just to state some key points:
play_pause
I haven't used AS3 for a while, I'm guessing I'm making a really noob mistake? Full code: http://pastebin.com/RirGdS1w
Link to .fla file: http://db.tt/51DD0Fbl
Perhaps someone else could fully explain this, but I found that once the SWF was embedded into an HTML page it worked as expected. It was when it was being run in Flash CS5.5 that it wasn't working. This will now be a nightmare to debug but for the purposes of the project tonight I have it working.