1 person found this helpful
do you set bubble true when dispatching the event?
if its a custom event you'll need to override the clone method to get it to bubble
Like Kokorito said, you custom event class must have "bubbles" set to true. Not only that, bubbling only applies for events dispatched from objects attached to the display list. So even if you have an event set to bubble, it won't be heard by anyone else up the chain unless it is a visual class.
Thanks guys. Now I know that the event will not be detected outside the custom class because the object is not attached to the display list. I also didn't know about overriding clone, so that is good to know. But if I want my event to be detectable outside the class, do I have to extend DisplayObject? It kind of seems like overkill to do that for an object that will not display on the screen. What do people usually do in this situation?
I have only seen it done in frameworks where they inject an event dispatcher. If you don't want to use a framework, you could just have a singleton ( vomits in throat ) and pass it a UIComponent. Now remember this UIComponent has to be attached to the display list so doing
var vbox:Group = new Group();
still won't be heard by the rest of the application. You would have to wait for some ui component to be added THEN pass it to your singleton for usage in the rest of the application. Honestly, I haven't given too much thought about it.
Thanks! I'll be using a framework now
Just stay far, far, far away from Cairngorm or PureMVC.