<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" applicationComplete="init()" > <fx:Script> <![CDATA[ import mx.controls.Alert; import mx.events.CloseEvent; protected function init():void{ Alert.show("你要保存你的更改吗","保存",Alert.YES|Alert.NO,this, onAlertClose); } protected function onAlertClose(event:CloseEvent):void{ if(event.detail == Alert.YES) statuseField.text ="你选择了YES" else statuseField.text = "你选择了NO" } ]]> </fx:Script> <s:Label id="statuseField" horizontalCenter="0" verticalCenter="0" text="选择以前"/> </s:Application>