2013-01-31 74 views
3

我使用Adobe Flash CS6设计桌面应用程序,使用air 3.2作为桌面(在Flash目标设置中)。在空气设置中,有一个高级选项卡,可以设置应用程序窗口位置的初始值。我不知道该如何将它设置在屏幕中间。Adob​​e Air - Flash - 初始窗口位置

这里是截图:

enter image description here

回答

4

不要使用这些属性,只需将代码添加到您的应用程序:

stage.nativeWindow.x = (Capabilities.screenResolutionX - this.width)*0.5; 
stage.nativeWindow.y = (Capabilities.screenResolutionY - this.height)*0.5; 
+0

谢谢!只是一个小小的变化,尽管......在第二行,它应该是高度。 :D – Milad

+0

是的,我修好了,谢谢。 –

0

对于基于HTML/JS-AIR项目,你可以使用:

window.moveTo(Math.round((window.screen.availWidth - window.outerWidth)/2), Math.round((window.screen.availHeight - window.outerHeight)/2)); 
0
var screenBounds:Rectangle = Screen.mainScreen.bounds; 
stage.nativeWindow.x = (screenBounds.width - stage.nativeWindow.width)/2; 
stage.nativeWindow.y = (screenBounds.height - stage.nativeWindow.height)/2; 

适用于我

+0

嗨,你可以请给你的代码添加一些解释吗?这会在审查队列中弹出,因为代码只是答案。 – Will