简体   繁体   中英

Using events vs. directly calling parent application function from a child in Flex / Flash Builder

If I need to call a specific function in the parent application from a child in a flex project, what's the best practice for this? Would it be to dispatch a custom event from the child and have a listener call that function? Or to directly call the function with FlexGlobals.topLevelApplication?

OOP会说事件是要走的路,因为全局变量是反对OOP的,并且因为事件至少会促进呼叫者和被呼叫者之间的某种程度的分离。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM