一般用法:
AppEvent.addListener("menu_selected",function(evt:AppEvent):void { var data:Object=evt.data as Object; rightArea.removeAllElements(); var widget:Class=getDefinitionByName(data.widget as String) as Class; widgets=new widget(); rightArea.addElement(widgets); });
AppEvent.dispatch("menu_selected",data);
自定义事件:
调用:
<component:ImageSwap id="mainImage" width="670" height="100%" preClick="mainImage_preClickHandler(event)"
nextClick="mainImage_nextClickHandler(event)"/>
声明:
实现:
this.dispatchEvent(new Event('imageLoaded'));
dispatchEvent(new MouseEvent("preClick"));
dispatchEvent(new MouseEvent("nextClick"));