lundi 25 mai 2015

mute and unmute button as3 flash

I'm trying to create a mute and unmute button. I don't want any play/pause button just mute and unmute. So far all I've created is the mute button, the problem is I have no clue as to make an unmute button. I'd also like the mute icon to change its appearance to unmute icon once it's clicked. Any help is greatly appreciated, thanks everyone.(some side comments or explanations would be nice too)

Hope I'm not asking for too much. Here's my code so far

var soundReq:URLRequest = new URLRequest("assets/for_flash.mp3");  
var sound:Sound = new Sound();  
var channel:SoundChannel = new SoundChannel();

sound.load(soundReq);

sound.addEventListener(Event.COMPLETE, onComplete);

    function onComplete (e:Event):void
    {
        sound.play();
    }

mute_btn.addEventListener(MouseEvent.CLICK, muteSound);

    function muteSound(e:MouseEvent):void
    {
        SoundMixer.stopAll();
    }

Aucun commentaire:

Enregistrer un commentaire