国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 图木舒克市| 达州市| 陵川县| 河西区| 榆社县| 疏附县| 湾仔区| 海南省| 英山县| 庆云县| 彰化市| 盘山县| 崇明县| 金湖县| 毕节市| 连平县| 峡江县| 长宁区| 贵南县| 宜州市| 抚松县| 股票| 驻马店市| 和林格尔县| 枣阳市| 桂阳县| 通州区| 淮南市| 抚州市| 武义县| 漯河市| 内黄县| 巴东县| 乐陵市| 英山县| 温宿县| 宿州市| 淮阳县| 白城市| 东海县| 鲁山县|