Can we change stage size dynamically?

隐身守侯 提交于 2019-12-13 10:53:24

问题


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)


来源:https://stackoverflow.com/questions/27226047/can-we-change-stage-size-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!