Mega Code Archive

 
Categories / Flex / Event
 

Add itself to event handler

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     layout="absolute">     <mx:Script>                  private function fillLabel(evt:Event):void         {             myLabel.text = evt.target.label;             myButton2.addEventListener(MouseEvent.CLICK,fillLabel);         }            </mx:Script>     <mx:Panel x="320" y="127" width="250" height="200" layout="absolute"         title="Testing Events">         <mx:Label x="55" y="45" id="myLabel" />         <mx:Button label="Test" id="myButton" x="90" y="96"             click="fillLabel(event)" />         <mx:Button label="Test 2" id="myButton2" x="90" y="126" />     </mx:Panel> </mx:Application>