Using event object to make event handlers more generic
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> import mx.controls.Alert; public function clickHandler(clickEvent:Event):void{ Alert.show("Event Type:" + clickEvent.type); Alert.show("came from:" + clickEvent.currentTarget.id); } </mx:Script> <mx:Button id="Me" label="Handle Click" click="clickHandler(event)" /> </mx:Application>