Ok, it’s probably not a glitch. I assume I’m doing something wrong. I’m doing a little practice animation (CS3) and I’m making the buttons grow on rollover and shrink back down on rollout. It works just fine except that if I move the mouse a little too fast the rollout doesn’t work and the button I just rolled out of stays large. Code below:
var aButtons:Array = new Array(mcBtn1, mcBtn2, mcBtn3, mcBtn4, mcBtn5, mcBtn6, mcBtn7, mcBtn8, mcBtn9, mcBtn10, mcBtn11, mcBtn12, mcBtn13, mcBtn14, mcBtn15);
for (var i:Number = 0; i<aButtons.length; i++) {
if (this.aButtons.length == this.aClips.length) {
index = i;
aButtons[index].i = index;
trace(index);
for (var j:Number = 0; j<aClips.length; j++) {
if (this.i == j) {
trace(j);
clipOpen(j);
}
}
}
}
function clipOpen(num) {
function rollOver(evt:Event):void {
function buttonGrow(evt:Event):void {
aButtons[num].width+=4;
aButtons[num].height+=4;
if (aButtons[num].width>=45) {
aButtons[num].removeEventListener(Event.ENTER_FRAME,buttonGrow);
}
}
aButtons[num].addEventListener(Event.ENTER_FRAME,buttonGrow);
}
aButtons[num].addEventListener(MouseEvent.ROLL_OVER,rollOver);
function rollOut(evt:Event):void{
function buttonShrink(evt:Event):void {
aButtons[num].width-=4;
aButtons[num].height-=4;
if(aButtons[num].width<=34.5){
aButtons[num].removeEventListener(Event.ENTER_FRAME,buttonShrink);
}
}
aButtons[num].addEventListener(Event.ENTER_FRAME,buttonShrink);
}
aButtons[num].addEventListener(MouseEvent.ROLL_OUT,rollOut);
}