AdamAtomic/flixel — Issue #207: Mouse.as doesn't like negative cursor offsets mixed with native Flash
Author: ChainedLupine
Created: 2011-12-04 21:57:48+00:00
State: open

This is a bit of an edge case, but it's something that will be a rather unfun "gotcha" if you happen to be mixing native Flash display objects with Flixel.

If you want to center a mouse cursor, and use something like this:

FlxG.mouse.show (ImgMouseRecticle, 1, -12, -12) ;

Then mouse events will stop firing for any Flash objects which happen to be above the FlxCamera Sprites but below the Mouse sprite. The reason for this is because the _cursor sprite will always be on top of whatever is below, and will receive all of the mouse events and not pass them on (as is default). (With a positive offset, you would never notice this because the _cursor sprite wouldn't be on top of the mouse location.)

A solution to this is to add

_cursorContainer.mouseEnabled = false ;

To the Mouse constructor.