How to scale my app to fit device dimensions?
My apps dimensions are 800x450.
My android devices dimensions are 540x960.
With this of course when I installed on device the app appeared non scaled inside a window on my mobile device.
I have the XML set to the
Now I'll show you some of my code.
public static var gameStage:Stage;
....
public function initApplication():void
{
this._game = new MovieClip;
super.addChild(this._game);
}
private function initThreeBalls():void
{
gameStage = this._game.stage;
var starBackGround:Stars = new Stars; // Add a background large 1200 x 3000 texture
...
}
Here is some code I found here:
var appScale:Number = 1;
var appSize:Rectangle = guiSize.clone();
var appLeftOffset:Number = 0; // if device is wider than GUI's aspect ratio, height determines scale
if ((deviceSize.width/deviceSize.height) > (guiSize.width/guiSize.height))
{
appScale = deviceSize.height / guiSize.height; appSize.width = deviceSize.width / appScale;
appLeftOffset = Math.round((appSize.width - guiSize.width) / 2);
} // if device is taller than GUI's aspect ratio, width determines scale
else { appScale = deviceSize.width / guiSize.width;
appSize.height = deviceSize.height / appScale; appLeftOffset = 0;
}
http://www.adobe.com/devnet/air/articles/multiple-screen-sizes.html
Wondering what elements I apply this code to?
It doesnt seem to work with Stage..
