How to maintain the hover state of a button while it is in it's current page?
Hi,
I'm just a beginner in actionscript 3. I have this code about navigation using movieclip buttons. I just made the currently selected button disabled when it is in the current page but I just cant figure out on how to maintain it in its hover state (It keeps on returning to its normal state). Any ideas, your help will be very much appreciated. Thanks.
Here's the code I've written on the first frame on the main timeline(scene1), I have 4 buttons namely mcButton1, mcButton2, mcButton3, mcButton4 and 4 labeled frames, page1, page2, page3 and page4.:
var page:String;
var btnArray:Array = [mcButton1, mcButton2, mcButton3, mcButton4];
var pageArray:Array = ["page1", "page2", "page3", "page4"];
for (var i:int = 0; i < btnArray.length; i++) {
btnArray.buttonMode = true;
btnArray.addEventListener(MouseEvent.CLICK, onMouseClick);
btnArray.addEventListener(MouseEvent.ROLL_OUT, onMouseOut);
btnArray.addEventListener(MouseEvent.ROLL_OVER, onMouseOver);
}
function onMouseClick(event:MouseEvent):void {
for (var i:int = 0; i < btnArray.length; i++) {
if (event.currentTarget == btnArray) {
btnArray.mouseEnabled = false;
page=pageArray;
play();
}
else {
btnArray.mouseEnabled = true;
}
}
}
function onMouseOut(event:MouseEvent){
event.currentTarget.gotoAndPlay("out");
}
function onMouseOver(event:MouseEvent){
event.currentTarget.gotoAndPlay("over");
}