AS3 - 打开多个/多个窗口+检测系统上有多少个屏幕

时间:2014-11-03 12:38:14

标签: actionscript-3 flash air fullscreen desktop

我想知道是否可以创建一个空中桌面应用程序,当打开时检测到连接到计算机的屏幕数量,打开一个"控制器"主屏幕上的窗口和一个"演示"在辅助屏幕上以全屏模式显示窗口。

目前,我发现的唯一工作是通过LocalConnection

进行两个相互通信的应用程序

1 个答案:

答案 0 :(得分:1)

要检测AIR中的屏幕数量:

flash.display.Screen.screens.length   //Screen.screens property is an array of all the screens on the system

//you can get things like the bounds, color depth etc

要从主窗口打开第二个窗口,这是一个示例:

       var myContent:Sprite = new Sprite(); //this would be whatever display object you want on the new window.

       //SOME OPTIONAL WINDOW OPTIONS
       var windowOptions:NativeWindowInitOptions = new NativeWindowInitOptions();
       windowOptions.owner = stage.nativeWindow; //setting the owner to the main window means that if this main window is closed, it will also close this new window
       windowOptions.renderMode = NativeWindowRenderMode.AUTO;
       windowOptions.systemChrome = NativeWindowSystemChrome.STANDARD;

       //Create the new window
       var newScreen:NativeWindow = new NativeWindow(windowOptions);

       newScreen.title = "My New Window";
       newScreen.stage.addChild(content);

       //the screen to put it on
       var screen:Screen = Screen.screens[Screen.screens.length - 1]; //get a reference to the last screen
       //move the new window to the desired screen
       newScreen.x = (screen.bounds.left);
       newScreen.y = (screen.bounds.top);

       //focus the new window
       newScreen.activate();

对于全屏,您要么最大化窗口,要么进入闪光灯的全屏模式:

      newScreen.maximize();
      newScreen.stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;

您可以像处理任何其他显示对象一样处理窗口内容。您可以根据需要向Windows阶段添加任意数量的内容。