Duarte Miranda
Duarte Miranda

Reputation: 13

User defined resolution in AS3

For the last couple of days I've been wondering if it would be possible to let the user define the resolution to be used, when building for an AIR application.

Say if I have my SWF set up at a 1280x720 resolution by default, would it be possible to have, in the main menu, a set of resolutions, for instance 1366x768 or 1024x768, that the user can choose and then scale the window that contains the game to that size?

Upvotes: 1

Views: 89

Answers (1)

BadFeelingAboutThis
BadFeelingAboutThis

Reputation: 14406

With AIR, you can manipulate a window's size from your code.

For the window of the current code's scope, you can do:

stage.nativeWindow.width = 1280;
stage.nativeWindow.height = 720;

OR, if you want to move the window to a particular spot and size:

stage.nativeWindow.bounds = new Rectangle(0,0,1280,720);

Or, you can use NativeApplication.nativeApplication.activeWindow or one of the items (windows) from NativeApplication.nativeApplication.openedWindows

Upvotes: 2

Related Questions