Actionscript 3 不使用Flex的ActionScript弹出窗口
有没有办法使用纯ActionScript弹出一个类似于Flex中PopupManager创建的窗口?当窗口弹出时,背景应该是灰色的。这就是我的结论:Actionscript 3 不使用Flex的ActionScript弹出窗口,actionscript-3,popupwindow,Actionscript 3,Popupwindow,有没有办法使用纯ActionScript弹出一个类似于Flex中PopupManager创建的窗口?当窗口弹出时,背景应该是灰色的。这就是我的结论: import flash.display.DisplayObjectContainer; import flash.display.Sprite; import screens.GameScreen; /** * The PopUpManager is used to pop up a dialog. * <p> * Usag
import flash.display.DisplayObjectContainer;
import flash.display.Sprite;
import screens.GameScreen;
/**
* The PopUpManager is used to pop up a dialog.
* <p>
* Usage:
* <p>
* <code>
* var dialog:Sprite = ... // initialize a Sprite
* // To pop up
* PopUpManager.openPopUp(stage, dialog);
* // To close the pop-up
* PopUpManager.removePopUp();
* </code>
*/
public final class PopUpManager
{
private static var instance:PopUpManager;
private static var dialog:Sprite;
private static var curtain:Sprite;
/**
* @param parent The parent of this pop up window. If it is other display object other than stage,
* only that display object will be dimmed.
* @param dialog The dialog to be popped up.
*/
public static function openPopUp(parent:DisplayObjectContainer, dialog:Sprite, modal:Boolean):void
{
if(curtain == null) {
// Init the curtain to dim the screen or part of the screen
curtain = new Sprite();
curtain.graphics.beginFill(0xFFFFFF,.4);
curtain.graphics.drawRect(0,0,parent.width/GameScreen.dpiScale,parent.width/GameScreen.dpiScale);
curtain.graphics.endFill();
}
curtain.mouseEnabled = modal;
parent.addChild(curtain);
PopUpManager.dialog = dialog;
curtain.addChild(dialog);
}
public static function removePopUp():void
{
curtain.removeChild(PopUpManager.dialog);
curtain.parent.removeChild(curtain);
}
}
这是一个AIR应用程序还是一个SWF?这是iOSAha的AIR应用程序,好的。我有一个桌面AIR应用程序的解决方案,但它使用的是
NativeWindows
,我从来没有为iOS开发过。