2014-11-03 22 views
0

我想知道是否可以创建一个空气桌面应用程序,当打开时检测到连接到计算机的屏幕数量,打开一个“控制器“窗口和辅助屏幕上全屏模式下的一个”演示“窗口。AS3 - 打开几个/多个窗口+检测系统上有多少个屏幕

目前唯一的解决办法,我发现是做两个应用程序,通过LocalConnection

回答

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(); 

全屏,你要么最大化窗口,或输入闪光灯的全画面M. ode:

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

您可以像处理任何其他显示对象一样处理窗口的内容。你可以根据需要添加尽可能多的东西到windows阶段。

+0

非常感谢您的快速回答@LDMS。虽然我无法将主窗口设置为所有者'windowOptions.owner = stage.nativeWindow;'您提供给我的代码工作正常,并且对于进一步调查而言是一个很好的开始。 你有什么暗示为什么我不能把它作为所有者? PS:也谢谢你编辑我的问题 – quasi 2014-11-03 21:38:25