开发者

mouse events reset

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");


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜