Mouse Events

I dug further into the mouse issue today, and it's turning out to be a weird one.

As far as I can tell, the trouble stems from the way a trackpad registers a mouse click, as compared to a normal mouse or the trackpad's button. A normal mouse click looks like this:

-register mouse button down
-process mouse button down
-register mouse button up
-process mouse button up

but a trackpad looks more like this:

-register mouse button down
-register mouse button up
-process mouse button up

Somehow, the trackpad is registering a down and up instantly, overwriting the "down" before Flixel has a chance to process it. And because of the way Flixel handles in-game button presses (like the "New Game" or item context buttons), Flixel never sees the button press.

After looking at it a bit, I thought I could be clever by installing an event queue in the mouse handler, to ensure each step in the button press had a chance to process. However, my first tests of this system seem to be no different. And this has me doubting whether I fully understand the problem.

Ultimately, I think this is due to the way Flixel tries to intercept mouse events from Flash. The in-game buttons use Flash's built-in event handler, which is working okay. But the button has to be "pressed" when this event happens for anything to trigger, and that "pressed" status is only set during the button's update() method. And this update() method is the thing missing from the list of trackpad events above. (Between "register mouse button down" and "register mouse button up").

Normally, I'd consider moving on in a case like this. It's an issue that only affects a tiny percentage of players (MS Surface users and MacBook users running Windows/Bootcamp without a hardware mouse), and takes a lot of time to fix. However, I have a suspicion that this may also be the case when it comes time to try tablet editions. That means it could affect even more users, so it may be worth investigating further. More on that tomorrow, probably.

Hope everyone has a good night!