Ted Patrick > { Events & Community } > Adobe Systems


Custom Flex 2 Builder Compiler Options

There are 3 important compiler options that everyone should know for Flex 2. These allow you to set the background color, size, and Frame Rate within the output SWF file. These settings are currently undocumented but not for long!

In Flex Builder 2:

1. Open Project Properties >> Flex Compiler

2. Add the following into "Additional compiler arguments:" in single line:

-default-frame-rate 50

-default-background-color #FFFFFF

-default-size 800 600


These are very important settings as they set values within the SWF header directly. These will be present within your application before any ActionScript is executed and before your application is preloaded.

The "-default-background-color" will color the preloader in your Flex application and avoid the brief flash of color when CSS style initializes within your flex application. It is a good practice to set this value the same as your backgroundColor and soon the new CSS Application fill-colors property.

The "-default-frame-rate" is very important in relation to performance. The framerate will determine the maximum rate per second that the DisplayList is rendered. As ActionScript execution is interleaved between every render to the DisplayList, changing the frame rate can double and triple your application performance.

Note: The maximum frame rate is limited to machine performance, if this value is set too high the player will simply run at the fastest rate that it can on the given machine.

The "-default-size" property sets the width and height of the SWF file in the header. If you open the SWF within the standalone Flash Player this is the size the window will default to.

Keep these in your back pocket, you will need them. More to come!

Regards,

Ted :)

12 Responses to “ Custom Flex 2 Builder Compiler Options ”

  1. # Blogger BIT-101

    I was digging around for these exact three options just yesterday. I can never find the link to the options list. Finally remembered that Mike Chambers posted a link to it the other day. :)  

  2. # Anonymous William

    Hi Ted.
    I was just wondering if Flex allows for custom designed preloaders in addition to the the default  

  3. # Blogger Ted Patrick

    William,

    Flex 1.5 and Flex 2 do support custom pre-loaders. Let me put together an example in a blog post next week for you.

    I have some great knowledge to share on this. :)

    Regards,

    Ted :)  

  4. # Anonymous William

    I'll really appreciate that Ted. Can't wait to see you sample.

    Regards  

  5. # Anonymous Anonymous

    I prefer to use metatags in my code by using the SWF metatag like this:

    [SWF(width="800", height="600", frameRate="60", backgroundColor="#8899aa")]  

  6. # Blogger Ted Patrick

    Nice, a META for editing the SWF header! Not in the docs either...

    hmmmm.....

    Maybe its time to do a blog post about Meta-Tags in Flex.  

  7. # Blogger Ted Patrick

    ok, so the SWF Meta only seems to work for me in ASProject not in a Flex Project, yet the compiler options work perfectly in both.

    What is cool is that the META tags have compiler preference in that if both meta tags and compiler options are present, the meta tag win.

    An advantage of the meta tags is that they modify the HTML templating output too.

    Need to get some more detail on this.  

  8. # Anonymous William

    Hi Ted,
    still waiting for that custom built preloader for flex tutorial you promised. Just thought i'd remind ya  

  9. # Blogger Ted Patrick

    William,

    I was waiting til Beta3 was public to post this. Sorry for the delay.

    Ted :)  

  10. # Anonymous Anonymous

    I wonder if you could shed some light on the difference between the "debug" and the "run" compilation process in Flex Builder 2. Specifically I am trying to use the keep-as3-metadata flag. When I compile in debug mode it works, when I compile in run mode it does not. Any thoughts?
    - Michael  

  11. # Blogger Vengu

    Ted,

    How do I set compiler options for applications that are compiled on the
    server? Say when I am using Flex data services?

    Thanks,
    Venkat  

  12. # Blogger Vengu

    Hi Ted,

    I noticed something strange with the flash player downloads widget you have on your blog ..

    I removed my network cable and it is still kept rolling the download numbers !

    where is it getting the data from now!?

    Just wanted to know if that is a real indication on flash player downloads..

    No offense intended :-) And sorry of this is a real stupid question  

Post a Comment



Jobs


Flex Jobs
city, state, zip


© 2008 Ted On Flash