Am working on flash cs6 and AIR 14.I developed one app i want to adjust that app to all android and ios devices.for that i want to change my stage size dynamically according to screen resolution of device.Is it possible to do that.if yes how ?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, It is possible.
First thing you need to do is the following: (as soon as your application has access to the stage)
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
This will make your stage not scale and become the full size of it's container - in your case an AIR window.
For mobile AIR, this will make it the screen resolution of the device. Though on some high-density displays (iPhone) by default you may get half the native resolution of the device, but scaled x2 so it's still fullscreen. You can adjust this when you build the application in AIR if needed.
For desktop AIR, you can programmatically change the stage by resizing the NativeWindow
.
stage.nativeWindow.width = 1234; //set the width of the stage's window (which will in turn set the stage size if scaleMode is NO_SCALE)