2009-12-27 97 views

回答

1

试试这个(这是JavaScript的):

var bounds = null; 
var screen = air.Screen.mainScreen.visibleBounds; 

bounds = new air.Rectangle(
    (screen.width - WINDOW_WIDTH)/2, 
    (screen.height - WINDOW_HEIGHT)/2, 
    WINDOW_WIDTH, 
    WINDOW_HEIGHT 
); 

htmlLoader.stage.nativeWindow.bounds = bounds; 
+1

WINDOW_WIDTH和WINDOW_HEIGHT默认没有定义,所以我不得不手动设置它们。但除此之外,它完全奏效。谢谢。 – 2009-12-27 22:00:15

1

要把它放到应用程序的creationComplete事件处理

var screenBounds:Rectangle = Screen.mainScreen.bounds; 
nativeWindow.x = (screenBounds.width - nativeWindow.width)/2; 
nativeWindow.y = (screenBounds.height - nativeWindow.height)/2; 
+0

对不起,应该提到我需要使用JavaScript来做到这一点。 – 2009-12-27 20:55:43