Flex Tip of the Day: -keep-generated-actionscript
Continuing my series of Flex tips for beginners ….
-keep-generated-actionscript
When you compile an mxml application, all your mxml is first converted to actionscript and then this actionscript is further compiled into a SWF. You can see this generated actionscript to learn the flex framework in depth using the flex compiler flag -keep-generated-actionscript.
To set this flag in Flex Builder right click to open the project Properties, select Flex Compiler, and add -keep-generated-actionscript to the Additional compiler arguments …. now rebuild the project and you will see a new folder called ‘generated’ that appears and has all the generated code.
You could also use just the short form -keep in place of the long -keep-generated-actionscript.

UPDATE: I had earlier posted a screen shot without the -keep-generated-actionscript flag showing. (how silly am I) … anyways, I’ve corrected that now.









July 10th, 2007
As a shortcut, you can use “-keep” if you’d rather not type out the rest.
July 19th, 2007
Hi Mrinal,
I am trying to learn Actionscript.
But I am finding it hard to get started as I don’t know exactly which Adobe product I need to download.
I believe we need to have:
Flex Builder to write Actionscript (.as file)
Flash CS3 to attach it and compile it (.swf file)
Can you please direct me here. Then I can perhaps understand better what you write next in your blog.
July 19th, 2007
Hi Rahul,
You just need either one of the products to do it all …. you can write and compile a pure actionscript application in either Flex Builder or Flash CS3.
At this early stage I would highly recommend reading Adobe Livedocs
At the same time I would also suggest you join the flex-india mailing list to get all your queries answered .. there are over 300 developers on that list helping each other out.
July 19th, 2007
Hi Mrinal,
Can I also use Eclipse for Flex Development with the Flex plugin. Is it for free.
I want to build the first program in Actionscript and Flash today. It could be the simplest of them, e.g. just a HELLO WORLD progam.
Can U advise me how to proceed.
I did went through the Flex livedocs, could get an overview.
Can get started once I have installed thse softwares. Do U always work with the Trial version, or U work on a licensed version.
For now, plz hlp me with HELLO WORLD on AS3,
regds,
Rahul.
August 22nd, 2007
Sir, I owe you a beer!
August 20th, 2008
Really Helpful ! Thanks Mrinal
October 1st, 2008
To understand the generated actionscript is impossible.
I thought i could easily convert my MXML component into corresponding Actionscript Class
April 17th, 2009
hey, i can’t find that in flex builder anywhere – can you show me some screen shots perhaps..
June 18th, 2009
interesting option -keep in flex compiler to convert mxml to as. http://bit.ly/9Knb
October 31st, 2009
Hi Mrinal, As per the above tip, i could not find the “-keep-generated-actionscript” or “-keep” option under the project Properties, select Flex Compiler. Can you please suggest me how to see the actio n script file..any mistake i did .?
Thanks,
Ravi
November 2nd, 2009
Hi Ravi,
This post is old so looks like my screenshot above got lost in a wordpress upgrade … anyway ..
Project Properties > Flex Compiler > Additional Compiler Arguments:
You have to add -keep to that textbox
Mrinal
April 2nd, 2010
[...] we compile our Example application the compiler will generate a class (you can see it with -keep) that subclasses our ApplicationLoader factory and implements some additional functionality .. an [...]