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
Alert 组件使用
最新推荐文章于 2019-01-02 17:13:28 发布