Old Articles - 2 years, 5 months ago - 1 Comment

Flex 2 Compilation - Hidden Goodies

We all like to know a little more about what goes on under the hood of our favourite tools. Undocumented features and the like have a certain appeal that gets everybody excited.

Flex Builder 2 which is currently in public beta has a little known gem of a feature (for which documentation is scarse) which you can use to learn alot more about what Flex actually does under the hood to make all that mxml markup goodness into a working Flash movie. This compiler option did not work in the previous public alpha build.

The brains of Flex 2 lie in the compiler (AKA MXMLC) which internally converts all your mxml markup into Actionscript 3 classes ready for the next stage of the process which is Actionscript compilation. The Flex 2 compiler accepts certain arguments (or compiler flags) that allow you to change the way it operates slightly.

There are plenty of these compiler flags but my favourite has to be the option that tells MXMLC to keep all of the Actionscript 3 classes that it has generated as part of the project building process. You can then view these actionscript files to find out more about how Flex actually works.

The compiler flag i speak of is called -keep-generated-actionscript and you can turn it on in Flex Builder 2 for your own pleasure by doing the following:

  1. Right-click a Flex Project in the Navigator Panel.
  2. Select Properties from the Context Menu.
  3. Select Flex Compiler in the Properties Window.
  4. Enter -keep-generated-actionscript into the ‘Additional compiler arguments’ field.
  5. Click ‘OK’ to apply the changes.
  6. Build your Flex Project by clicking the Run button.
  7. Right-click your Flex Project again in the Navigator Panel.
  8. Choose Refresh from the Context-Menu.
  9. A new folder should appear under your Flex Project in the Navigator Panel, named ‘generated’

Inside the ‘generated’ folder lies the under the hood Actionscript 3 files that the compiler generates as an interim stage of the whole compilation process. Open them up and have a nosey as to what Flex 2 is actually doing under the hood to setup all the default component styles etc… it’s an awesome feature, lets hope they keep it in there.

Enjoy.



1 Comment

You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.

Karthikeyan
Jul 25, 2007 15:54

Thanks, Your tip put initil lights on the FLex.

Note: This is an old article!

Please be aware that the content of this article may no longer be accurate and the links contained within could be broken.

Update Notifications

You can add our RSS feed to your favorite feed reader or recieve an email when a new article is posted by entering your email address below.

    Shu Player allows you to distribute your AIR Applications to users that dont have the AIR Runtime by converting them to standalone applications. Shu Player also adds more commands to do things like open external applications etc…


    If you hate the Adobe Updater like most of us, then just get rid of it.


    Want to quickly find out what version of the Flash Player a client has installed? Send them to www.playerversion.com


    Yet more pv3d goodness. Im loving this funky 3D Flash Lab, the work of Mathieu Badimon. [Update: Apparently this uses Five3D not PaperVision]


    There is an old interview with me on The FWA, its fairly long at 8 pages.


    If you do alot of travelling then it makes sense to get yourself a Priority Pass, which will get you access to over 500 airport lounges worldwide, regardless of whether your flying enconomy, business or first.


    Freelance Switch is a freelancer community with forums, jobs, daily tips and a complete 212 page e-book titled “How to be a rockstar freelancer” for sale.


    Lots of new media jobs at Creative Pool.


    BBC IPlayer is awesome, but its ashame that BBC News is still using Windows Media Player and Real video. Real player is officially badware.


More In Actionscript


More In Adobe Flash


More In Freelancing