I just threw this super simple code example into the Flash CS4 script framework, but it does not output anything to the console. I just roll the mouse over the window without clicking anything and nothing happens. Why is this not working as I expect?
stage.addEventListener(Event.MOUSE_LEAVE, traceMouse);
function traceMouse(Evt:Event):void
{
trace("Mouse Left Stage");
}
________________________________________________
[EDIT] I find Event.MOUSE_LEAVE incredibly worthless. firstly, it does not work in a test environment (at least on Flash CS4 for Mac OS X). secondly, it does not work if MouseEvent.MOUSE_DOWN is currently active:
Flash CS4 Professional ActionScript 3.0 Language Reference:
Updated 8/11/09: Qualification added. This event does not work when the button is pressed. 1
, , MOUSE_LEAVE , , , , stopDrag(). , MOUSE_OUT , MOUSE_LEAVE .
private function mouseDownHandler(evt:MouseEvent):void
{
object.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
object.startDrag(false, pullBounds);
}
private function mouseUpHandler(evt:MouseEvent):void
{
object.removeEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
object.stopDrag();
}
private function mouseOutHandler(evt:MouseEvent):void
{
object.stopDrag();
}