Pass in user function to alert box
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<mx:Script>
import mx.controls.Alert;
import mx.events.CloseEvent;
[Bindable]
[Embed(source='a.png')]
private var Icon:Class;
private function showAlert():void {
var titleText:String = "WARNING";
var messageText:String = "OK to continue, Cancel to abort.";
var a:Alert = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
}
private function doClose(evt:CloseEvent):void {
trace("close");
}
</mx:Script>
<mx:Button label="Launch Alert" click="showAlert();" />
</mx:Application>
Related examples in the same category