Flex : Allowing mouse events to “pass through” an overlay
I ran into an issue today I didn’t immediately have an answer for.
I added an overlay to the map of my Xuland flex-based social networking tool which resembled a radar (concentric circles, tinted slightly green):
Before adding the radar overlay, I could drag the map as normal, however after adding the overlay atop the visible map area, the map no longer responded to mouse drag events.
Before writing a lot of code to catch and re-dispatch mouse events from the overlay to the map, I admit I felt a little silly after discovering a simple property that just needed to get added to my overlay:
1 2 3 4
<map:RadarOverlay id="radar" buttonMode="true" useHandCursor="true" mouseEnabled="false"/>
As the API mentions: “Specifies whether this object receives mouse messages. The default value is true, which means that by default any InteractiveObject instance that is on the display list receives mouse events. If mouseEnabled is set to false, the instance does not receive any mouse events. Any children of this instance on the display list are not affected. ”
And it worked perfectly!