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.topLevelApplicatio开发者_如何学Gon?
OOP would say that Events are the way to go, since globals are anti-OOP and also since the event at least promotes some level of separation between the caller and the callee.
精彩评论