flex3.6入门学习笔记之八 Alert的3种应用

不明白可以给我留言

<?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>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值