In ordinary work, there is often such a requirement: click on a module to trigger an event, and need to monitor it on another page. For example, another module performs another operation after the click operation of the button is executed in the current module, so how is the click event in the current page known by another module? This can be dispatched using flex events.
//当前模块
private function buttonClick(event:MouseEvent):void
{
var appEvent:AppEven = new AppEvent("youThingName",false);
EventDispatcher(FlexGlobal.topLevelApplication).dispatchEvent(appEvent);
}
//接收模块
EventDispatcher(FlexGlobal.topLevelApplication).addEventListener("youThingName",执行函数)