views:

16

answers:

1

I got random picture that I want to rotate it (motion tween) for 180º with MOUSE_OVER event. I have another function that returns the picture -180º with MOUSE_OUT event. The problem is when the MOUSE_OUT event triggers while the MOUSE_OVER event is still active.

stop();

sClock.addEventListener(MouseEvent.MOUSE_OVER, Frwrd);
sClock.addEventListener(MouseEvent.MOUSE_OUT, Bck);

function Frwrd(event:MouseEvent):void
{
    this.gotoAndPlay("2");
}
function Bck(event:MouseEvent):void
{
    this.gotoAndPlay("21");
}

If I use the labels of the frames, instead of "2" and "21", it's even weirder.

stop();

sClock.addEventListener(MouseEvent.MOUSE_OVER, Frwrd);
sClock.addEventListener(MouseEvent.MOUSE_OUT, Bck);

function Frwrd(event:MouseEvent):void
{
    this.gotoAndPlay("RotationStart");
}
function Bck(event:MouseEvent):void
{
    this.gotoAndPlay("RotationEnd");
A: 

Start with adding a MouseOver listener . When you mouse over an object, the Tween starts , I would consider removing the MouseOver listener at that point, let the rotation complete then add your MouseOut listener. Same logic with the MouseOut, as soon as the MouseOut is triggered, remove the listener and when the Tween is complete, add the MouseOver.

PatrickS