Free your mouse!We just released on Adobe Labs, Flash Player 11.2 and AIR 3.2 (beta 2) builds.

Note that you guys now have access to standalone debugger builds. Yeah, I know. After 4 years, it was about time! The cool news is that those builds introduce a few cool new features, like mouse lock, right and middle click events and the ability to disable the context menu entirely.

Mouse lock:

A new mouseLock property has been added to Stage. To enable mouse locking set Stage.mouseLock to true. There are several rules which are applied here:

  • This property can only be set in full screen mode.
  • It dispatches a runtime exception if it is called in non-full screen mode.
  • On mobile settings this property always throws an exception. The reason is simple: This feature can only work with a mouse typeof devices and mobile devices do not have such a thing.
  • The property can be read in non-full screen mode. This allows developers to easily dispatch to alternative input methods if mouse locking is disabled externally for some reason.
  • When exiting full screen mode Stage.mouseLock is automatically set to false. Note that while in full screen mode mouse event listeners attached to other display objects but the stage will not be dispatched.
  • In other words to receive mouse deltas and any other mouse event while mouseLock is active you need to attach your mouse event listeners to the stage.

Relative mouse coordinates - New properties (movementX and movementY) on MouseEvent:

When Stage.mouseLock == true:

  • MouseEvent.localX and MouseEvent.localY will contain 0.MouseEvent.movementX and MouseEvent.movementY will contain delta values.
  • MouseEvent.movementX and MouseEvent.movementY are never transformed based on stage transformation, i.e. they always remain in screen space.
  • MouseEvent.movementX and MouseEvent.movementY will be 0 when Stage.mouseLock == false.

Situations where mouse locking is disabled automatically and the mouse cursor is made visible again:

  • When the user hits ESC.
  • When the window loses focus, for instance when the user hit CTRL-TAB.
  • When any settings UI is visible (that includes all privacy dialogs). When a native dialog is shown, for instance a file upload dialog.

Right and middle click events:

Just like with Adobe AIR, right and middle click events can now be used to inside Flash Player. When a listener is registered to the MouseEvent.RIGHT_CLICK event, the native context menu will not show up, allowing you tocreate your own context menu.

I am sure you guys will make good use of that! :)