Mike Morearty
27 Jun 2006

Setting the width and height of a pure-ActionScript application

For a Flex project with MXML files, it is obvious how to set the width and height of the project:

<mx:Application width="300" height="200">

But for pure-ActionScript projects, it isn’t so obvious. The way to do it is to use the SWF metadata attribute above the declaration of the class:

package
{
  [SWF(width="300", height="200")]
  public class MyApp extends Sprite
  {
    ...
  }
}

The values specified there are pixel sizes; in this context, you are not allowed to use percentage values such as 100%.

comments powered by Disqus