2009-12-27 95 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