Define an event handler inline and binds a call to the handler function to the control : Event Handler « Event « Flex
- Flex
- Event
- Event Handler
Define an event handler inline and binds a call to the handler function to the control

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.controls.Alert;
private function myEventHandler(event:Event):void {
Alert.show("An event occurred");
}
</mx:Script>
<mx:Button id="b1" label="Click Me" click="myEventHandler(event)" />
</mx:Application>
Related examples in the same category