I have a flex application where the child dispatches an event inside a parent:
child:
<fx:Metadata>
[Event(name="myEvent", type="flash.events.Event")]
</fx:Metadata>
<fx:Script>
<![CDATA[
dispatchEvent(new Event("myEvent"));
]]>
</fx:Script>
parent:
<comp:poppy id="myPopup" myEvent="myEventStuff(event);" />
I've changed my code so that I create myChild in actionscript, rather than the mxml tag as shown. How do I add the event listener in actionscript?
public function showPoppy(evt:MouseEvent):void {
var myPopup:poppy = PopUpManager.createPopUp(this, poppy, true) as poppy;
PopUpManager.centerPopUp(myPopup:poppy );
myPopup:poppy.includeInLayout = true;
myPopup:poppy.visible = true;
// how do I add the event listener?
}