Handle a Button's Click Event
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="app_creationCompleteHandler(event)">
<mx:Script>
import mx.events.FlexEvent;
protected var names:Array = ['A','B','C'];
protected var titles:Array = ['a','b','c'];
protected function app_creationCompleteHandler(event:FlexEvent):void
{
btn.addEventListener(MouseEvent.CLICK, showNames);
btn.addEventListener(MouseEvent.CLICK, showtitles);
}
protected function showNames(event:MouseEvent):void
{
trace(names.toString());
}
protected function showtitles(event:MouseEvent):void
{
trace(titles.toString());
}
</mx:Script>
<mx:Button id="btn" label="Show Names and Titles"/>
</mx:Application>
Related examples in the same category