hbkmad Posted March 21, 2015 Share Posted March 21, 2015 Hi, So I want to use a mute button to... wait for it... mute my music. Ok I've done that, but when the new level starts it generates new Mute button and the new Button is in default frame. I want it to change at the begining and go to the "mute" frame if the music was paused in previous states. Here is the code I can't understand why the frame option does not work.//preloadthis.load.audio('music', ['assets/audio/bckrg1.ogg', 'assets/audio/bckrg2.mp3']);//creategame.muteBtn = game.add.button(100, 0, "muteBtn", function (e) {if (e.frame === 0) { //I could use if music.isPlaying but the same logic goes with the framesconsole.log("muting");music.pause(); //music is local variable with the music of the gamee.frame = 1; //this works and change the frame of the button to the frame that shows muted button}else {console.log("unmuting");music.play();e.frame = 0; //this works and change the frame of the button to the frame that is unmuted button}}, this);if (!music.isPlaying) {game.muteBtn.frame = 1; //this does not work} Link to comment Share on other sites More sharing options...
Recommended Posts