不明白可以给我留言
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600">
<mx:Script>
<![CDATA[
import mx.controls.Alert;//添加引用提示框控件,默认 没有
import mx.events.CloseEvent;//调用close函数,用于对提示框的判定
protected function but1_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
Alert.show("确定")
}
protected function but2_clickHandler(event:MouseEvent):void
{
// TODO Auto-generated method stub
Alert.show("?","title",3,this,alterclose)//中间数字为tag值 不同值对应不同按钮出现 3表示有确定和取消按钮
}
protected function alterclose(event:CloseEvent):void
{
if(event.detail==Alert.YES)
xz.text="true"
else if (event.detail==Alert.NO)
xz.text="false"
else
xz.text="cancel"
}
protected function Alt(event:MouseEvent):void
{
// TODO Auto-generated method stub
Alert.yesLabel="true" //设置每个按钮的值
Alert.noLabel="false"
Alert.cancelLabel="cancel"
Alert.show("?","title",1|2|8,this,alterclose)//1.2.8代表有3个按钮,比如是确定 取消 和退出
}
//1- Alert.YES
//2- Alert.NO
//3- Alert.YES | Alert.NO
//4- Alert.OK
// 5- Alert.OK | Alert.YES
//6- Alert.OK | Alert.NO
//7- Alert.OK | Alert.YES | Alert.NO
// 8- Alert.CANCEL
//9- Alert.YES | Alert.CANCEL
// 10- Alert.NO | Alert.CANCEL
// 11- Alert.YES | Alert.NO | Alert.CANCEL
12- Alert.OK | Alert.CANCEL
// 13- Alert.OK | Alert.YES | Alert.CANCEL
//14- Alert.OK | Alert.NO | Alert.CANCEL
// 15- Alert.OK | Alert.YES | Alert.NO | Alert.CANCEL
// 16- Alert.OK (和4一样)
// 17开始返回到1重新按顺序循环
]]>
</mx:Script>
<mx:Button id="but1" x="327" y="79" label="按钮" click="but1_clickHandler(event)"/>
<mx:Button id="but2" x="327" y="183" label="按钮" click="but2_clickHandler(event)"/>
<mx:Label id="xz" x="327" y="242" width="166" text="标签"/>
<mx:Button id="but3" x="327" y="309" label="按钮" click="Alt(event)"/>
</mx:Application>