Setting framerate and stage size in AS3 project using Flex
March 10th, 2008 by
Adrian Parr
UPDATE 29/07/2010: Flash CS4 and CS5 now support this metadata, and will override the stage properties that are set in the IDE.
If you are creating an AS3 only project in Flex then at some point you will want to set the framerate, stage size, and stage colour. This is not obvious to find and can be done in one of two ways.
The first method is by providing this information as compiler arguments in the Flex IDE. Go to Project > Properties > ActionScript Compiler. And in the ‘Additional compiler arguments:’ textfield you could enter the following …
-default-frame-rate 25 -default-background-color #FFFFFF -default-size 800 600
The second method is by putting this information in to your main AS3 class as metadata. For example …
import flash.display.Sprite;
[SWF(width='800',height='600',backgroundColor='#ffffff',frameRate='25')]
public class Test extends Sprite {
public function Test() {
}
}
}
Make sure you put the SWF Metadata AFTER any import statements.
Here are a couple of other blog entries on the subject …
Posted in ActionScript 3.0, Flex |
January 22nd, 2010 at 5:39 pm
I think it needs to be frameRate (with a capital ‘R’). Doesn’t seem to work with a lower-case ‘r’.
April 21st, 2010 at 3:24 pm
@John: Thanks for spotting that. I’ve now corrected the sample code.