Monday, July 2, 2012

[Action Script] Movie Clip Buttons: Code for Each Button "Overlapping"? July,2012

I have a set of movie clip buttons (please see the attached graphic), which during testing I've found that if I run the mouse over each of them, quickly, in succession, some of the buttons get "stuck" in the "over" mode, (the white text). The button cannot be reset to the "up" mode (gray text) until I roll over the stuck button again.

Here's the code for HOME, which are how the remaining six buttons are coded:

Code: //++++++++++++++++
// "HOME" button
//
btnHome.addEventListener(MouseEvent.ROLL_OVER, mouseRollOver);
function mouseRollOver(evt:MouseEvent):void
{
        btnHome.addEventListener(MouseEvent.ROLL_OUT, mouseRollOut);
        btnHome.gotoAndPlay("rollOver");

}

function mouseRollOut(evt:MouseEvent):void
{
        btnHome.gotoAndPlay("rollOut");

}

btnHome.addEventListener(MouseEvent.CLICK, mouseClick);
function mouseClick(evt:MouseEvent):void
{
        btnHome.removeEventListener(MouseEvent.ROLL_OUT, mouseRollOut);
        btnHome.removeEventListener(MouseEvent.ROLL_OVER, mouseRollOver);

        btnHome.hitAreaHome.mouseEnabled = false;
       
}

//++++++++++++++++
// "BIO" button
//What I think is happening is that as I roll out of one button and roll over another, the roll over code for that other button is maybe interfering with the completion of either the roll out function or animation for the previous button.

What can I do to ensure that one button's code/ animations complete its cycles regardless of what other button(s) I may roll over/ out of?
Attached Thumbnails Click image for larger versionName:	movieClipButtonTroubles.jpgViews:	N/ASize:	11.2 KBID:	38579 
Movie Clip Buttons: Code for Each Button "Overlapping"?

Related Post



0 comments: