Flex中自定义组件中的冒泡事件 [英] Bubbling events within custom components in Flex
问题描述
我在Flex mxml应用程序文件的另一个自定义组件中使用了自定义组件。是否可以将事件从内部组件中冒泡到外部组件并处理外部组件中的事件?
启用冒泡后,事件将继续在UI树中调度,直到 Event.stopPropagation 或 Event.stopImmediatePropagation 被调用。请记住,冒泡只影响UI组件;即使将 I am using a custom component within another custom component in a flex mxml application file.Is it possible to bubble events from an inner component to the outer component and handle events in the outer component? The Once bubbling is enabled, the event will continue to be dispatched up the UI tree until Event.stopPropagation or Event.stopImmediatePropagation is called. Keep in mind, though, that bubbling only affects UI components; events fired from custom classes will not bubble, even if the 这篇关于Flex中自定义组件中的冒泡事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! Event
构造函数默认将 bubbles
参数设置为 false
因此,如 Patrick 提及,当你构造事件时,你需要设置
bubbles
为 true
。
bubbles
参数设置为 true
,自定义类触发的事件也不会冒泡。 b $ bEvent
constructor defaults the bubbles
parameter to false
so, as Patrick mentions, you need to set bubbles
to true
when you construct the event. bubbles
argument is set to true
.