我有一个自定义的拖动事件,它适用于大多数事情:
stage.addEventListener( MouseEvent.MOUSE_DOWN, beginDrag );
function beginDrag( e:MouseEvent )
{
stage.addEventListener( MouseEvent.MOUSE_MOVE, drag );
stage.addEventListener( MouseEvent.MOUSE_UP, endDrag );
stage.addEventListener( MouseEvent.DEACTIVATE, endDrag );
stage.addEventListener( Event.MOUSE_LEAVE, endDrag );
stage.addEventListener( Event.REMOVED_FROM_STAGE, stageEndDrag );
//trigger beginDrag event
}
function drag( e:MouseEvent )
{
//trigger drag event
}
function endDrag( e:Event )
{
stage.removeEventListener( MouseEvent.MOUSE_MOVE, drag );
stage.removeEventListener( MouseEvent.MOUSE_UP, endDrag );
stage.removeEventListener( MouseEvent.DEACTIVATE, endDrag );
stage.removeEventListener( Event.MOUSE_LEAVE, endDrag );
stage.removeEventListener( Event.REMOVED_FROM_STAGE, stageEndDrag );
//trigger endDrag event
}
问题是当我使用此代码wmode=transparent
或事件发生在舞台外时未检测到wmode=opaque
事件。MOUSE_LEAVE
MOUSE_UP
有没有办法在is或MOUSE_LEAVE
时检测事件?wmode
transparent
opaque
或者
有没有办法检测到wmode
设置为transparent
或opaque
可以实施解决方法?