I have a UIComponent that sits on top of a grid visually, which is also a UIComponent. The grid and the UIComponent that sits on top are on different branches. The gird has children which are Sprites. When the MousEvent.CLICK is dispatched it goes to the UIComponent on top. What I want it to do is go the element of the grid underneath. Is this possible?
相关问题
- garbage collection best practices
- How to load flex swf from flash?
- FlashDevelop Haxe (Flash) debugger
- Detecting user's camera settings
- Displaying two fullscreen windows on two monitors
相关文章
- Are there any benefits when using final in AS3?
- Trace on Chrome/Browser console
- as3 ByteArray to Hex (binary hex representation)
- About Collision detection alghorithms in AS3
- How to upload BitmapData to a server (ActionScript
- Manage resources to minimize garbage collection ac
- as3 object values NativeText
- Error 1009 in AS3
Yes you can,
if your element id is "ui_component"
then in ActionScript you should add two properties
This will tell your component to pass click event on MovieClip behind it.
I hope this helps.
Another option, if your implementation does not allow for you to disable the mouse events for the top UIComponent, is to manually redispatch the event.
Here's a rather generic example. Attach the following handler for a
MouseEvent.CLICK
to either the container that holds the other UIComponents or the one on the UIComponent on top:This code would work as follows in MXML:
This is very generic. I'd recommend using something more specific than
UIComponent
, otherwise it would probably dispatch more clicks than are necessary. That all depends on what you're actually doing.Also, the MXML example is rather poor, since, if you knew all your components beforehand you could definitely handle it differently. However, if you had a bunch of components whose positions were determined at runtime, this would approach would make more sense.
What I had to do was just make the UIComponent on top
top.mousEnabled = false