flex Alert组件用法

  1. <? xml   version = "1.0" ?>   
  2. <!-- Simple example to demonstrate the Alert control. -->   
  3. < mx:Application   xmlns:mx = "http://www.adobe.com/2006/mxml" >   
  4.   
  5.     < mx:Script >   
  6.         <![CDATA[  
  7.             import mx.controls.Alert;  
  8.             import mx.events.CloseEvent;  
  9.           
  10.             // Event handler function uses a static method to show  
  11.             // a pop-up window with the title, message, and requested buttons.          
  12.             private function clickHandler(event:Event):void {  
  13.                 Alert.show("Do you want to save your changes?", "Save Changes", 3, this, alertClickHandler);  
  14.             }  
  15.           
  16.             // Event handler function for displaying the selected Alert button.  
  17.             private function alertClickHandler(event:CloseEvent):void {  
  18.                 if (event.detail==Alert.YES)  
  19.                     status.text="You answered Yes";  
  20.                 else  
  21.                     status.text="You answered No";  
  22.             }  
  23.  
  24.             // Event handler function changes the default Button labels and sets the  
  25.             // Button widths. If you later use an Alert with the default Buttons,   
  26.             // you must reset these values.  
  27.             private function secondClickHandler(event:Event):void {  
  28.                 Alert.buttonWidth = 100;  
  29.                 Alert.yesLabel = "Magenta";  
  30.                 Alert.noLabel = "Blue";  
  31.                 Alert.cancelLabel = "Green";  
  32.  
  33.                 Alert.show("Select a color:","Color Selection",1|2|8,this);  
  34.                   
  35.                 // Set the labels back to normal:  
  36.                 Alert.yesLabel = "Yes";  
  37.                 Alert.noLabel = "No";                  
  38.             }  
  39.         ]]>   
  40.     </ mx:Script >   
  41.   
  42.     < mx:Panel   title = "Alert Control Example"   width = "75%"   horizontalAlign = "center"   paddingTop = "10" >   
  43.       < mx:Text   width = "100%"   color = "blue"   textAlign = "center"   fontSize = "12"    
  44.           text = "点击下面按钮弹出一个简单的Alert窗口." />   
  45.       < mx:Button   label = "点击我"   click = "Alert.show('Hello World!', 'Message');" />   
  46.   
  47.       < mx:Text   width = "100%"   color = "blue"   textAlign = "center"   fontSize = "12"    
  48.           text = "点击下面按钮弹出一个Alert窗口,并且捕获你按下的按钮." />   
  49.       < mx:Button   label = "点击我"   click = "clickHandler(event);" />   
  50.       < mx:Label   id = "status"   fontWeight = "bold" />   
  51.   
  52.       < mx:Text   width = "100%"   color = "blue"   textAlign = "center"   fontSize = "12"    
  53.           text = "点击下面按钮弹出一个包括自定义标签按钮的Alert窗口." />   
  54.       < mx:Button   label = "点击我"   click = "secondClickHandler(event);" />   
  55.     </ mx:Panel >   
  56.   
  57. </ mx:Application >  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值