开发者

Flash AS3/Mouse position between startDrag and stopDrag

开发者 https://www.devze.com 2023-03-09 11:54 出处:网络
I have a \'drag item\' and som开发者_开发知识库e \'drop target\' so I want to highlight drop target while \'drag item\' is dragging so need to track mouse position or listen the mouse move event. I tr

I have a 'drag item' and som开发者_开发知识库e 'drop target' so I want to highlight drop target while 'drag item' is dragging so need to track mouse position or listen the mouse move event. I try subscribe ENTER_FRAME event and do hit test but wonder there's any solution for this case. Thank you.


stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);

function onMouseMove(e:MouseEvent):void
{
   //Do your thing here
   e.updateAfterEvent();
}

Note that if you're listening for start/stop drag then you should add/remove the MOUSE_MOVE listener when the start/stop events take place.

0

精彩评论

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