11 June 2012

root.scaleX

I recently completed an image creation project using Adobe Flash and Adobe Air. After spending many hours on the project I was exciting to find that I could get Adobe Air to work with the device’s built-in image saving mechanism (called the “CameraRoll”). That excited quickly disappeared as I found out that images saved with the CameraRoll were really lousy quality, small but lousy. After brainstorming on how to fix the issue, I discovered that if I changed the resolution of the project from 480x320 to 1440x960 (a threefold increase) that the quality issue became a moot point and the image size was still small.

Enter problem two: I adjusted the stage to the new resolution easily enough, but I had to figure out how to increase all the assets threefold. This project has a large number of assets and the thought of scaling them all up was overwhelmingly daunting. Then I realized that I could just scale up the root object and, because everything but the stage is part of root, everything that mattered would also be scaled up.

So, in an effort to share information with the world, if you find that your Adobe Flash project needs to be a higher resolution than when you first built it, and you want to avoid rescaling every element in your project, simply increase the stage size and add in some Action Script to scale up root (root.scaleX = 2; root.scaleY = 2;).

No comments:

Post a Comment