I'm currently porting a Flash game to OUYA (an Android powered device) via Adobe Air.
Most of the work has been done already; it's packaged up and runs on Android devices.
However! It's stuck in a tiny corner on the screen, as seen in this picture
What I want is for the game to scale to the full size of the screen, while keeping the aspect ratio. I've seen other Flash to Air to Android games do this, so I know it's possible, I just don't know how.
Anyone have any tips? Thanks!
Read up on stage.scaleMode:
That should be exactly what you need.
Another option to preserve aspect ratio is if you have a parent container that holds everything is scale it to fit yourself:
var widthRatio:Number = stage.stageWidth / BASE_WIDTH;
var heightRatio:Number = stage.stageHeight / BASE_HEIGHT;
if (widthRatio < heightRatio)
{
container.scaleX = container.scaleY = widthRatio;
}
else
{
container.scaleX = container.scaleY = heightRatio;
}
At that point you could either center the container to the stage:
container.x = (stage.stageWidth - container.width) /2;
container.y = (stage.stageHeight - container.height) / 2;
Or do something else with it.