Check Whick button clicked in Alert box close evevt
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical">
<mx:Button id="btn" click="showAlert(event)" label="Alert"/>
<mx:Label id="lbl"/>
<mx:Script>
import mx.events.CloseEvent;
import mx.controls.Alert;
import mx.events.MenuEvent;
private function showAlert(evt:MouseEvent):void {
var alert:Alert = Alert.show("Button was clicked","Alert Window Title",Alert.OK|Alert.CANCEL|Alert.NO|Alert.YES,this,onAlertClose);
}
private function onAlertClose(evt:CloseEvent):void {
switch(evt.detail) {
case Alert.OK:
lbl.text = "OK Clicked";
break;
case Alert.CANCEL:
lbl.text = "CANCEL Clicked";
break;
case Alert.NO:
lbl.text = "NO Clicked";
break;
case Alert.YES:
lbl.text = "YES Clicked";
break;
}
}
</mx:Script>
</mx:Application>
Related examples in the same category