Why aren't MOUSE_MOVE events dispatched when the middle mouse button is pressed?

I am listening for MOUSE_MOVE events.

They are sent and received only with a penalty if the middle mouse button is not held down. I don't get any more MOUSE_MOVE events until the middle button is released.

Is this a Flash issue, or something to do with my specific mouse / computer configuration (bluetooth Mighty Mouse on Lion)?

Are there any known workarounds?

Here is a sample project to demonstrate the problem.
Left-clicking and dragging mouse traces move events, but middle-clicking shows only the middle mouse and middle mouse up.

import flash.events.MouseEvent;

this.stage.addEventListener(MouseEvent.MIDDLE_MOUSE_DOWN, onMiddleMouseDown);
this.stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);

function onMiddleMouseDown(e:MouseEvent):void {
trace("middle down");

this.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
this.stage.addEventListener(MouseEvent.MIDDLE_MOUSE_UP, onMiddleMouseUp);

function onMouseMove(e:MouseEvent):void {
trace("mouse move");

function onMiddleMouseUp(e:MouseEvent):void {
trace("middle up");

this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
this.stage.removeEventListener(MouseEvent.MIDDLE_MOUSE_UP, onMiddleMouseUp);

function onMouseDown(e:MouseEvent):void {

this.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
this.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);

function onMouseUp(e:MouseEvent):void {

this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
this.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);


It looks like the position of the mouse (the mouseX and mouseY properties) is not updated when the middle button is held down. I would still like to know why, or if there is a workaround for this.


source to share

3 answers

It looks like it was a bug in Flash Player for Mac.
Adobe fixed it:



Let's just assume, but the middle mouse button is usually set in most drivers to enable scrolling. This probably means that instead of the mouse movement messages, the window gets some kind of scrolling when the button is pressed.



Do you really need the MOUSE_MOVE event? In most cases, the ENTER_FRAME event can replace it pretty well.

addEventListener(Event.ENTER_FRAME, eFrame);
private function eFrame(event:Event):void




All Articles