You could check the "target" property.
target:"The InteractiveObject instance under the pointing device. The
targetis not always the object in the display list that registered the event listener. Use the
currentTargetproperty to access the object in the display list that is currently processing the event."
Thanks, that I know.
What I don't know is how I can listen for mouse click from inside a component, regardless of where the mouse was clicked.
I am trying to build sort of a context menu that closes when the mouse is clicked anywhere else except itself.
event.target!=myMenu, but how can I listen for clicks anywhere inside the app?
Add click event listener to your Application
Yeah, but that won't fire if the click is on another PopUpManager window for example.
This is probably done at SystemManager level, but I can't figure out how to do that and check from inside a PopUp for example.
1 person found this helpful
Add the listener to stage.In your main Application file,use like this.stage.addEventListener(MouseEvent.CLICK,onClick).
To add the listener to the system manager in your main app:
When user right-clicks to get the menu, and then clicks elsewhere in the app, the checkForMenu event listener will be called, and then you may need to use the systemManager numChildren property and getChildAt() method in a for loop to inspect the systemManager children, and if the child type is the type of the popup component that displayed the menu, then close its menu.
If this post answers your question or helps, please mark it as such.
Greg Lafrance - Flex 2 and 3 ACE certified
Flex / AIR Development, Training, and Support Services