grumpytoad/jeash — pull request #3 by jgranick (2012-04-12 21:14:23+00:00)
Title: Event updates

I brought in some code from NME to help improve the events a little bit.

When a DisplayObjectContainer has "mouseChildren" set to false, child events should be treated as if they originated from the container. "event.target" should equal the container, and events should not be dispatched from the children. At first I thought this was connected to code I brought over, but I realize that must be handled internally on the C++ side of NME.

This does not block events from occuring for children, but does set the target so that it will come through properly. A side effect is that custom event bubbling (calling dispatchEvent on your own) should probably work now, and overriding the dispatchEvent method in your own DisplayObjectContainer should probably also behave better as well (the nmeDispatchEvent method was added to handle these cases)

This was causing issues in the Pirate Pig sample. One mouse listener is added to the tile container, and each tile has mouseChildren set to false. Instead of the target being the tile, it was the bitmap inside. After this change it works properly.