我试图将一个已启动的窗口置于flex中,有一个NativeWindow.x和NativeWindow.y但是flex使用没有这些属性的Window类,所以有人知道如何使窗口居中吗?谢谢!
答案 0 :(得分:3)
我明白了:
window.nativeWindow.x = (Screen.mainScreen.bounds.width - window.width)/2;
window.nativeWindow.y = (Screen.mainScreen.bounds.height - window.height)/2;
我认为你必须把这个AFTER window.open()称为。
答案 1 :(得分:2)
这就是我使用的
nativeWindow.x = (Capabilities.screenResolutionX - nativeWindow.width) / 2;
nativeWindow.y = (Capabilities.screenResolutionY - nativeWindow.height) / 2;
似乎运作良好
答案 2 :(得分:1)
这不是更好吗?
示例文档:
// center the window on the screen
var screenBounds:Rectangle = Screen.mainScreen.bounds;
nativeWindow.x = (screenBounds.width - nativeWindow.width) / 2;
nativeWindow.y = (screenBounds.height - nativeWindow.height) / 2;
from livedocs: about window containers ¨
即使在多屏幕系统(Win7)上,这两种解决方案也适用于我
答案 3 :(得分:0)
实际上这在flex 4.5及以上版本中效果更好
nativeWindow.x = (Screen.mainScreen.bounds.width - nativeWindow.width)/2;
nativeWindow.y = (Screen.mainScreen.bounds.height - nativeWindow.height)/2;