Listen to a Button Click
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"> <mx:Button id="btn" label="Show Names" click="showNames(event)"/> <mx:Script> private function showNames(evt:MouseEvent):void { var temp:Array = new Array("A","B","C","D"); trace(temp.toString()); } </mx:Script> </mx:Application>