1 <?xml version="1.0" encoding="utf-8"?>
2 <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
3 xmlns:s="library://ns.adobe.com/flex/spark"
4 xmlns:mx="library://ns.adobe.com/flex/mx"
5 minWidth="955" minHeight="600">
6 <fx:Script>
7
8 <![CDATA[
9 import mx.controls.Alert;
10 import mx.events.CloseEvent;
11 private function clickHandler(event:Event):void {
12 Alert.buttonWidth=100;
13 Alert.yesLabel="是";
14 Alert.noLabel="否";
15 Alert.show("你要保存改变吗","提示",Alert.YES | Alert.NO,this,alertCallBack);
16 }
17 private function alertCallBack(event:CloseEvent):void{
18 if(event.detail==Alert.YES)
19 {trace("yes");}else {trace("no");}
20 }
21 ]]>
22
23
24 </fx:Script>
25 <mx:Panel title="弹窗" width="75%" horizontalAlign="center" paddingTop="10">
26 <mx:HBox>
27 <mx:Label id="status" fontWeight="bold"/>
28 </mx:HBox>
29 <mx:HBox>
30 <mx:Button label="按钮1" click="Alert.show(‘Say Hello‘, ‘标题‘);"/>
31 <mx:Button label="按钮2" click="clickHandler(event);"/>
32 </mx:HBox>
33 </mx:Panel>
34
35 </s:Application>