I have an application that has a dozen or so of the same
custom components on a canvas. If I click on one of the objects I
want the other 11 to all react to that event. Given that I am
rather new to Flex, I am a bit puzzled. Trace statements show that
all 12 components are all listening for the event; however, it
appears that when I click on one of the components the other 11 are
not in the bubbling path. So, I guess my question is how can
multiple children hear an event from their parent...or a sibling?
One easy way to do this is to have each child dispatch a
named event. make it bubbling, if the children are nested below the
Have a single listener for that named event in the main app.
Have the handler dispatch another event(or a clone of the one it
receives). Have each child listen to the main app for that event.
In each child component:
private var _app:Application;
in an init function:
_app = mx.core.Application.application;
Thanks for the advice. I was struggling with adding the
listener to the stage; however, the stage does not appear to be
available until after the application creation is complete. While
your solution did not work for me exactly as you presented it, it
was the key that I needed. All that I had to do was add the the
following to the init for my component: