Flex: Bubble events from custom classes - non-UI
I'm trying to find a good way to bubble events up a class tree for none-ui components.
I h开发者_StackOverflow社区ave a structure like this:
- Controller
- Unit of Work
- Child Unit 1 (Raise Event)
- Unit of Work
I would like to handle the event raised in Child Unit 1 in the Controller. I've tried to set the bubble property to true but I've read that this only works for UI components.
Is there a way to enable this for custom classes that are not UI components?
Bubbling only works if the class is part of a display hierarchy. Otherwise, how would you tell what the classes parent is? Even a UIComponent that has not been added tot he stage will not bubble events.
For non UIComponents, you're going to have to listen for, and re-dispatch, the event at each level.
精彩评论