Alert.show()的实例,代码如下:
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();"> <mx:Script> <![CDATA[ import mx.events.CloseEvent; import mx.controls.Alert; Alert.yesLabel="确定"; Alert.noLabel="取消"; //第一个属性:弹出框的内容 第二个:弹出框标题 第三个:提示框里面显示一个或多个按钮 第四个:父组件 //第五个:方法 public function init():void{ Alert.show("确定要取消此操作吗?","系统提示",Alert.YES|Alert.NO,this, handle); } //使用的是 CloseEvent public function handle(event:CloseEvent):void{ if(event.detail == Alert.YES){ ta.text = "yes"; }else if(event.detail == Alert.NO){ ta.text = "no"; } } ]]> </mx:Script> <mx:TextArea id="ta"> </mx:TextArea> </mx:Application>