开发者

Flex: Bubble events from custom classes - non-UI

开发者 https://www.devze.com 2023-03-22 18:52 出处:网络
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:

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)

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消