我开始放弃 Flex 论坛,所以我会在这里重新发帖,看看情况如何。长期潜伏者,第一次海报;-)
我在舞台上捕获键盘事件并通过框架调度自定义事件(伙伴,虽然我不知道这是一个重要问题),但我对范围很困惑。结构是:
--application(捕获键盘事件并调度自定义事件
-- mainPanel (receives dispatched events but mainCalendar (a child element)
is null on debugging. Obviously if I try to call a public method on
mainCalendar it errors out, even though it's a child of mainPanel.
However, mainCalendar is NOT null IF I use
FlexGlobals.topLevelApplication.mainPanel.mainCalendar.
Outerdocument and parentDocument do not expose mainCalendar either, BTW
-- mainCalendar (a custom component inside mainPanel with public methods.
Creation policy is 'all' and it's visible and exists long before I
trap any keystrokes at the top level)
有人可以花一点时间解释为什么 mainPanel 收到自定义事件时 mainCalendar 超出范围,即使 mainCalendar 是 mainPanel 的子项。有没有更好的方法来管理事件,所以我不必总是通过 topLevelApplication 处理组件?
谢谢