There is no onReleaseOutside call in AS3. So, to get that, the best way is to, when your MOUSE_DOWN event function is called, to add a MOUSE_UP event listener to the stage. Then remove that listener when the event is triggered.
eg.
myBtn.addEventListener(MouseEvent.MOUSE_DOWN, downHandler):
function downHandler(event:MouseEvent):void
{
stage.addEventListener(MouseEvent.MOUSE_UP, upHandler);
// do whatever on mouseDown eg. startDrag()
}
function upHandler(event:MouseEvent):void
{
stage.removeEventListener(MouseEvent.MOUSE_UP, upHandler);
// do whatever eg. stopDrag();
}
Tech Reference: AS3
Leave a Reply