gotoAndStop() not working as intended
Hello,
I have created a screen which has 2 movieclips which will be used as buttons; they are named button1_mc and button2_mc.
When each button is clicked it should go to frame 2 on the timeline (frame 1 as index starts at 0) of the movieclip to indicate it has been selected and reveal some accompanying text in a movieclip named either reveal1_mc or reveal2_mc. When one button is clicked, it should also set the other button back to frame 1 on its timeline to indicate it is no longer selected, and then hide the corresponding reveal_mc: I have created the "hideAll" function for this purpose.
My code:
var _this=this;
this.hideAll=function(){
this.button1_mc.gotoAndStop(0);
this.button2_mc.gotoAndStop(0);
this.reveal1_mc.visible=false;
this.reveal2_mc.visible=false;
}
this.hideAll();
this.button1_mc.addEventListener("click", reveal1);
function reveal1(){
_this.hideAll();
_this.reveal1_mc.visible=true;
_this.button1_mc.gotoAndStop(1);
}
this.button2_mc.addEventListener("click", reveal2);
function reveal2(){
_this.hideAll();
_this.reveal2_mc.visible=true;
_this.button2_mc.gotoAndStop(1);
}
The problem is that when i run the screen, the buttons automatically start on frame 2 as if they have been clicked (each of these movieclips has this.stop() on each frame too). Once one of the buttons is clicked however it then works as intended.
Can anyone suggest why it would be doing this?
Many thanks.
