我正在使用 AIR 3.3/Flash CS5.5 为 iOS 和 Android 编写应用程序。现在我遇到了问题,该应用程序不会在 iOS 设备上调整大小(在 ipod touch 4 上测试)。
这是我的代码:
public function Main() {
this.addEventListener(Event.ADDED , Init, false, 0, true);
}
private function Init(e:Event) {
this.removeEventListener(Event.ADDED , Init);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.addEventListener(Event.RESIZE , Resize, false, 0, true);
}
private function Resize(e:Event) {
stage.removeEventListener(Event.RESIZE, Resize);
var stageheight = Math.min(stage.fullScreenHeight, Screen.mainScreen.visibleBounds.height);
var stagewidth = Math.min(stage.fullScreenWidth, Screen.mainScreen.visibleBounds.width);
stage.stageHeight = Math.min(stagewidth, stageheight);
stage.stageWidth = Math.max(stagewidth, stageheight);
scaleFactor = stage.stageHeight / APP_ORG_HEIGHT;
NativeApplication.nativeApplication.systemIdleMode = SystemIdleMode.KEEP_AWAKE;
}
它适用于 Android 设备,但不适用于我的测试设备。
这是我的xml设置:
<initialWindow>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<fullScreen>true</fullScreen>
<aspectRatio>landscape</aspectRatio>
<renderMode>gpu</renderMode>
<autoOrients>false</autoOrients>
</initialWindow>
<android>
<manifestAdditions>
<![CDATA[<manifest android:installLocation="auto">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
</manifest>]]>
</manifestAdditions>
</android>
<iPhone>
<InfoAdditions>
<![CDATA[<key>UIDeviceFamily</key><array><string>1</string></array><key>UIPrerenderedIcon</key><true/><key>UIApplicationExitsOnSuspend</key><true/>]]>
</InfoAdditions>
<requestedDisplayResolution>high</requestedDisplayResolution>
</iPhone>