Mega Code Archive

 
Categories / Flex / Event
 

Add Click event listener with ActionScript

<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"     layout="absolute" creationComplete="initFunc()">     <mx:Button id="thisButton" label="Click button!" />     <mx:Script>              import mx.controls.Alert;     public function initFunc():void     {         thisButton.addEventListener("click",clickFunction);     }     public function clickFunction(event:Event):void     {         var message:String = "you clicked me! " + event.target.label;         Alert.show(message,"Event Test");     }        </mx:Script> </mx:Application>