Check event target id : Event Target « Event « Flex
- Flex
- Event
- Event Target
Check event target id
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
>
<mx:Script>
private function buttonClick(event:Event):void {
trace(event.target.id);
if(event.target.id == "buttonOne") {
trace(" button one was clicked")
} else {
trace(" button two was clicked");
}
}
</mx:Script>
<mx:Button click="buttonClick(event)" label="Click Me One" id="buttonOne"/>
<mx:Button click="buttonClick(event)" label="Click Me Two" id="buttonTwo"/>
</mx:Application>
Related examples in the same category