Set label for yes button, no button and cancel button
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300">
<mx:Script>
import mx.events.CloseEvent;
import mx.controls.Alert;
[Embed(source="a.png")]
private var iconclass:Class
private function createAlert():void
{
mx.controls.Alert.yesLabel = "Click Yes?"
mx.controls.Alert.noLabel = "Click No?"
mx.controls.Alert.cancelLabel = "Click Cancel?"
mx.controls.Alert.show("This is an alert", "title of the alert", 1|2|8, this, alertClosed, iconclass);
}
private function alertClosed(event:CloseEvent):void
{
trace(" alert closed ");
if(event.detail == Alert.YES)
{
trace(" user clicked yes ");
}
else if(event.detail == Alert.CANCEL)
{
trace(" user clicked cancle ");
}
else
{
trace(" user clicked no ");
}
}
</mx:Script>
<mx:Button label="Create Simple Alert" click="createAlert()"/>
</mx:Canvas>
</mx:Application>
Related examples in the same category