Alert 组件使用

1  <? xml version = " 1.0 "  encoding = " utf-8 " ?>
 2  < mx:Application xmlns:mx = " http://www.adobe.com/2006/mxml "  layout = " absolute " >
 3       < mx:Panel x = " 10 "  y = " 45 "  width = " 436 "  height = " 259 "  layout = " absolute "  fontSize = " 12 "  title = " Alert组件示例 " >
 4           < mx:Button x = " 39 "  y = " 47 "  label = " 点 我 "  click = " onClick() "  fontWeight = " normal " />
 5           < mx:Button x = " 116 "  y = " 47 "  label = " 点 我 "  fontWeight = " normal "  click = " onClickTitle() " />
 6           < mx:Button x = " 204 "  y = " 47 "  label = " 点 我 "  fontWeight = " normal "  click = " onClickConfrm() " />
 7           < mx:Label x = " 39 "  y = " 149 "  id = " alertResult "  fontWeight = " bold "  color = " #2500C7 "  width = " 219 " />
 8           < mx:Button x = " 295 "  y = " 47 "  label = " 点 我 "  fontWeight = " normal "  click = " onClickHandler() " />
 9       </ mx:Panel >
10       < mx:Script >
11           <! [CDATA[
12              import mx.events.CloseEvent;
13              import mx.controls.Alert;
14               internal  function onClick(): void
15              {
16                  Alert.show( " Hello World! " );
17              }
18              
19               internal  function onClickTitle(): void
20              {
21                  Alert.show( " Hello World! " , " 这里是标题 " );
22              }
23              
24               internal  function onClickConfrm(): void
25              {
26                  Alert.yesLabel = " " ;
27                  Alert.noLabel = " " ;
28                  Alert.show( " Hello World! " , " 这里是标题 " , 4 , this ,onCloseHandler);
29              }
30              
31               internal  function onCloseHandler(evt:CloseEvent): void
32              {
33                   if (evt.detail == Alert.YES)
34                  {
35                      alertResult.text  =   " 你选择的是:“是”! " ;
36                  }
37                   else
38                  {
39                      alertResult.text  =   " 你选择的是:“否”! " ;
40                  }
41              }
42              
43               internal  function onClickHandler(): void
44              {
45                  Alert.yesLabel = " " ;
46                  Alert.noLabel = " " ;
47                  Alert.cancelLabel = " 取消 " ;
48                  Alert.show( " Hello World! " , " 这里是标题 " , 1 | 2 | 8 , this ,onCloseHandler);
49              }
50          ]] >
51       </ mx:Script >
52  </ mx:Application >
53

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值