Sunday, March 01, 2009

FlexBuilder ActionScript Project's Stage Dimension Width and Height

I spent a good day or so trying to figure out why my stage dimensions were so out of whack when I compiled my Flash AS3 project out of FlexBuilder 3. I tried specifying the width and height in the HTML, I tried setting the stage dimensions via this.width and this.height, I tried combinations of various width and height settings all to no avail.

I searched with a plethora of keywords "actionscript" "project" "scale" "dimensions" "programmatically" "setting" "stage" "width" "height" "huge" "large" "SWF" "SDK" "flexbuilder" "3" "3.3" "3.2" but the combination that finally got me what I was looking for was "flash actionscript setting swf width height"

The solution that fixed my problem is in bold below:

package
{
[SWF(width=1024,height=768)]
public class Master extends Sprite
{
public function Master(){}
}
}

It's really very simple, although something I had never come across before. I made the jump from Flash directly to Flex without ever working with pure ActionScript projects until now.

1 comment:

  1. Thanks for the useful solution! And good luck in your Flex development.

    ReplyDelete