开发者

Equivalent of Event.MOUSE_LEAVE in AS2

What is the equivalent of this AS3 code in AS开发者_StackOverflow2?

stage.addEventListener(Event.MOUSE_LEAVE, callbackFunc);

private function callbackFunc(e:Event):void {
    // do something
}


I struggled with this for a while and ended up using JavaScript event listeners on the Flash HTML object and then tying that into Flash's External Interface to set flags for when the mouse over and out events occur. This seems to work perfectly without any bugs.


At first I thought it was just a rollout-

stage.onRollOut = function(){
    //the action could occur here
}

This doesn't seem to be working properly... but then again; you could define the stage as a MovieClip(). AS2 is a bit clunky when it comes to this sort of thing. I think most of the solutions would be hacks. I certainly loved how much simpler it was though. :)


You can check _xmouse property to see, if the mouse is not in clip

_root.onMouseMove = function()
{
    if(
       _xmouse <= 0 || 
       _ymouse <= 0 ||
       _xmouse >= Stage.width - 1 ||
       _ymouse >= Stage.height - 1
    )
     outCallBack();
}

function outCallback()
{
   bla;
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜