Event.MOUSE_LEAVE does not work in AS3

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();
  }
+3
2

, , html .

+1

, ( ):

: Chrome + Firefox MOUSE_LEAVE WMODE OPAQUE TRANSPARENT. - .

WINDOW . , ! grr... http://bugs.adobe.com/jira/browse/FP-892


-, , Event Event.MOUSE_LEAVE, MouseEvent. MOUSE_LEAVE e:MouseEvent, , ( debug flash player). , , , .

: ( endDrag mouseLeave(e:Event)

stage.addEventListener(MouseEvent.MOUSE_MOVE, drag);
stage.addEventListener(MouseEvent.MOUSE_UP, endDrag);
stage.addEventListener(Event.DEACTIVATE, endDrag);
stage.addEventListener(Event.MOUSE_LEAVE, mouseLeave);

private function mouseLeave(e:Event):void
{
    endDrag(new MouseEvent("MOUSE_LEAVE"));
}

public function endDrag(evt:MouseEvent):void
{
    /// handle end drag
}
+3

Source: https://habr.com/ru/post/1740224/


All Articles