Skip to main content
Known Participant
May 16, 2009
Pergunta

Not sure how to resolve glitchy (on my part) rollover

  • May 16, 2009
  • 2 respostas
  • 413 Visualizações

I have been working on an animated button that uses an if / else condition for it's display graphics. I actually have gotten it to work exactly how I want it to... for the most part, just need advice on final clean-up.

You can view the animation I am struggling with here: www.midnyc.com

So, as you will see, the rollover is constant, and the rollOut and the Click states both incorporate an if / else condition. The idea being, that the button switches graphics on click, and has two rollOut States to accomodate that.

It works fine, but I notice that if you move your mouse across it quickly, the second rollover state (the sentence graphic) is visible... which should not be occuring since there was never a click, and I am not really sure how to remedy that. Below is my code if anyone can determine the issue:

btn_disHit.buttonMode = true
btn_disCase.buttonMode = true

btn_disHit.addEventListener (MouseEvent.MOUSE_OVER, disOver);
btn_disHit.addEventListener (MouseEvent.CLICK, disClick);
btn_disHit.addEventListener (MouseEvent.MOUSE_OUT, disOut);

function disOver (e:MouseEvent):void{
    btn_disCase.gotoAndPlay ("disOver");
}

//10=end of over//16=disClick//17=disClickB//45=disOut//55=disOutB//

function disClick (event: MouseEvent):void
{
    if (btn_disCase.currentFrame == 10)
    {
        btn_disCase.gotoAndPlay (17);
    }
    else
    {
        btn_disCase.gotoAndPlay (10);
    }
}


function disOut (event: MouseEvent):void
{
    if (btn_disCase.currentFrame == 10)
    {
        btn_disCase.gotoAndPlay (45);
    }
    else
    {
        btn_disCase.gotoAndPlay (55);
    }
   
}

Este tópico foi fechado para respostas.

2 Respostas

Known Participant
May 16, 2009

sorry, got this figured out – wasn't paying attn to my labels again, disregard!

Known Participant
May 16, 2009

I see that my problem is that on the rollOver (which occupies frames 1-10) if I roll off that before the animation stops, then my condition works (in that it goes to the alternate rollOut state because the playhead is not at frame 10).

So, I am assuming that I should say:

if btn_disCase == 1-10) ... then use the normal rollOut state. Just not sure how to assign multiple frames here, or if it is possible?