在各模块中,利用systemManager.loaderInfo.sharedEvents对象,可作为共享事件对象来处理模块间事件传递。
例如:
[b]在module1中产生事件;[/b]
[b]在module2中处理事件:[/b]
*CommonEvent为因业务需要自定义的事件,含义大家可忽略。
例如:
[b]在module1中产生事件;[/b]
var sharedEventDispatcher:IEventDispatcher=systemManager.loaderInfo.sharedEvents;
sharedEventDispatcher.dispatchEvent(new CommonEvent("navigate"));
[b]在module2中处理事件:[/b]
var sharedEventDispatcher:IEventDispatcher=systemManager.loaderInfo.sharedEvents; sharedEventDispatcher.addEventListener("navigate",menu_navigate);
private function menu_navigate(event:CommonEvent):void{
//处理事件
}
*CommonEvent为因业务需要自定义的事件,含义大家可忽略。