How to set stage size at runtime?

Monkey Targets Forums/Flash/How to set stage size at runtime?

secondgear(Posted 2012) [#1]
Could you kindly tell me if it is possible to make an SWF that would automatically adjust it's stage size depending on the device screen dimensions?

I know we can set the fixed size by using
[SWF(width="640",height="480")]
in the ActionScript file.

However,
[SWF(width="100%",height="100%")]
is not valid.

And
game.stage.scaleMode = StageScaleMode.EXACT_FIT
just applies scaling after everything is already rendered by Monkey, which produces distorted and pixelated output.

Any ideas?

Thank you.


Origaming(Posted 2012) [#2]
use native code, add it on your module,
stage.stageWidth = xxx
stage.stageHeight = xxx