<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
creationComplete="initApp()">
<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.controls.Alert;
/* */
private function initApp():void
{
this.addEventListener(Event.CLOSING, onClosing);
}
/* */
private function onClosing( event:Event ):void
{
event.preventDefault();
Alert.yesLabel = "yea";
Alert.noLabel = "na";
Alert.show("You want to exit?","Close", Alert.YES|Alert.NO, this, alertHandler, null, 2);
}
/* */
private function alertHandler( event:CloseEvent ):void
{
if( event.detail == Alert.YES)
{
this.nativeApplication.exit();
}
}
]]>
</mx:Script>
</mx:WindowedApplication>
No comments:
Post a Comment