Alert.NONMODAL

可用性

Flash Player 6 (6.0.79.0)。

版本

Flash MX Professional 2004。

用法

Alert.NONMODAL

描述

属性(常数);十六进制常数值为 0x8000 的属性。此属性可用于 Alert.show() 方法的 flags 参数。此属性指示 Alert 窗口应该为非模态,从而允许用户与所显示的窗口下面的按钮和实例交互。默认情况下,用 Alert.show() 生成的窗口为模式窗口,这意味着除了当前打开的窗口外,用户不能单击其它任何地方。

示例

以下示例在舞台上显示两个 Button 组件实例。单击其中一个按钮可以打开一个模态窗口,这可防止关闭 Alert 窗口前用户单击其它按钮。第二个按钮可以打开一个非模态窗口,从而允许用户继续单击当前打开的非模态 Alert 窗口下面的按钮。若要测试此示例,请将 Alert 组件和 Button 组件的实例都添加到当前文档的库中,然后向主时间轴的第 1 帧添加以下代码:

import mx.controls.Alert;

this.createClassObject(mx.controls.Button, "modal_button", 10, {_x:10, _y:10});
this.createClassObject(mx.controls.Button, "nonmodal_button", 20, {_x:120, _y:10});

modal_button.label = "modal";
modal_button.addEventListener("click", modalListener);
function modalListener(evt_obj:Object):Void {
    var a:Alert = Alert.show("This is a modal Alert window", "Alert Test", Alert.OK, this);
    a.move(100, 100);
}

nonmodal_button.label = "nonmodal";
nonmodal_button.addEventListener("click", nonmodalListener);
function nonmodalListener(evt_obj:Object):Void {
    var a:MovieClip = Alert.show("This is a nonmodal Alert window", "Alert Test", Alert.OK | Alert.NONMODAL, this);
    a.move(100, 100);
}