Add an Event Listener in MXML
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Canvas width="400" height="300"> <mx:Script> private function buttonClick():void { trace(" Button has been clicked "); } </mx:Script> <mx:Button click="buttonClick()" label="Click Me"/> </mx:Canvas> </mx:Application>