国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網(wǎng)站 > WEB開發(fā) > 正文

3.19.創(chuàng)建和控制Alert

2024-04-27 13:51:51
字體:
供稿:網(wǎng)友
3.19.1 問題
我們需要創(chuàng)建一個Alert 控件并且控制它的顯示。
3.18.2 解決辦法
使用mx.controls.Alert 類的show 方法并且給show 方法注冊一個回調(diào)。
3.19.3 討論
我們可以通過使用mx.controls.Alert 的靜態(tài)引用,設(shè)置所有Alert 控件的屬性,這些設(shè)定的屬性值會一直保存到被再次覆蓋為止。

Alert 類的show 方法需要一個警告所要使用的消息,一個標(biāo)題,一組值以指定顯示各自的Yes, No, 或者Cance 按鈕,警報框的父組件,警報框關(guān)閉時的回調(diào)函數(shù)和警報框里顯示的一個圖標(biāo)。例如:
+展開
-ActionScript
mx.controls.Alert.show("This is an alert""title of the alert", 1|2|8, this,alertClosed, iconclass);

除了前面兩個參數(shù),其余的參數(shù)都是可選參數(shù)。默認(rèn)情況下,警報框會顯示一個標(biāo)簽為OK的按鈕,點擊這個按鈕即關(guān)閉該警報框。下面是完整的清單:
+展開
-XML
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxmlwidth="400"
height="300">

<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
import mx.controls.Alert;
[Embed(source="../../assets/4.png")]
private var iconclass:Class
private function createAlert():void
{
mx.controls.Alert.buttonHeight = 20;
mx.controls.Alert.buttonWidth = 150;
mx.controls.Alert.yesLabel = "Click Yes?"
mx.controls.Alert.noLabel = "Click No?"
mx.controls.Alert.cancelLabel = "Click Cancel?"
mx.controls.Alert.show("This is an alert", "title of
the alert", 1|2|8, this, alertClosed, iconclass);
}
private function alertClosed(event:CloseEvent):void
{
trace(" alert closed ");
if(event.detail == Alert.YES)
{
trace(" user clicked yes ");
}e
else if(event.detail == Alert.CANCEL)
{
trace(" user clicked cancle ");
}e
else
{
trace(" user clicked no ");
}
}

]]>
</mx:Script>
<mx:Button label="Create Simple Alertclick="createAlert()"/>
</mx:Canvas>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 姚安县| 赣榆县| 布拖县| 龙江县| 宣汉县| 台州市| 调兵山市| 招远市| 遵化市| 西充县| 综艺| 临朐县| 巴东县| 启东市| 东海县| 台中县| 临泉县| 根河市| 洛扎县| 于都县| 南雄市| 清镇市| 桑植县| 荣成市| 邢台市| 许昌市| 石屏县| 苗栗县| 阳城县| 固始县| 抚松县| 龙游县| 霍林郭勒市| 营口市| 抚顺县| 容城县| 承德县| 寿阳县| 孟连| 青神县| 遂平县|