Disabling button once click - code not working
I have six frames and six buttons that should navigate from frame to frame (each frame contains a different movie clip). I am trying to make it so that when I click on a button and it goes to the frame specified, that button becomes disabled while on that frame. Then if I click on a different button, THAT one becomes disabled after I go to the frame and the previous button becomes enabled again. The code below is not working ... it disables the button when I click another (move to a diff frame), but it doesn't enable it again, so basically ALL the buttons become inactive/disabled permanently.
What's wrong? Here's the code I have:
stop();
happy_btn.addEventListener(MouseEvent.CLICK, onHappyClick);
sad_btn.addEventListener(MouseEvent.CLICK, onSadClick);
angry_btn.addEventListener(MouseEvent.CLICK, onAngryClick);
tired_btn.addEventListener(MouseEvent.CLICK, onTiredClick);
scared_btn.addEventListener(MouseEvent.CLICK, onScaredClick);
surprised_btn.addEventListener(MouseEvent.CLICK, onSurprisedClick);
function onHappyClick(evt:MouseEvent):void {
gotoAndPlay("happy")
happy_btn.mouseEnabled = false;
}
happy_btn.mouseEnabled = true;
function onSadClick(evt:MouseEvent):void {
gotoAndPlay("sad")
sad_btn.mouseEnabled = false;
}
sad_btn.mouseEnabled = true;
function onAngryClick(evt:MouseEvent):void {
gotoAndPlay("angry")
angry_btn.mouseEnabled = false;
}
angry_btn.mouseEnabled = true;
function onTiredClick(evt:MouseEvent):void {
gotoAndPlay("tired")
tired_btn.mouseEnabled = false;
}
tired_btn.mouseEnabled = true;
function onScaredClick(evt:MouseEvent):void {
gotoAndPlay("scared")
scared_btn.mouseEnabled = false;
}
scared_btn.mouseEnabled = true;
function onSurprisedClick(evt:MouseEvent):void {
gotoAndPlay("surprised")
surprised_btn.mouseEnabled = false;
}
surprised_btn.mouseEnabled = true;