Nested inner function is called when the button is clicked
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="initApp()">
<mx:Script>
import mx.controls.Alert;
private function initApp():void {
b1.addEventListener("click",function(e:Event):void {Alert.show("The button was clicked");});
}
</mx:Script>
<mx:Button id='b1' label="Click Me" />
</mx:Application>
Related examples in the same category