Mega Code Archive

 
Categories / Flex / Components
 

Button AddEventListener method

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" creationComplete="initApp(event);">     <mx:Button id="btn" label="Show Names"/>     <mx:Script>                      import mx.events.FlexEvent;             private function initApp(evt:FlexEvent):void             {                 btn.addEventListener(MouseEvent.CLICK,showNames);                 btn.addEventListener(MouseEvent.CLICK,showTitles);             }             private function showNames(evt:MouseEvent):void             {                 var temp:Array = new Array("A","B","C","D");                 trace(temp.toString());             }             private function showTitles(evt:MouseEvent):void             {                 var temp:Array = new Array("Director","Vice-President","President","CEO");                 trace(temp.toString());             }            </mx:Script> </mx:Application>