Viewing a Flex application’s generated source code

by Peter deHaan on August 2, 2008

in Compiler, Flex 3 SDK, Flex Builder 3

The following example shows how you can view a Flex application’s generated source code by adding the -keep compiler argument in Flex Builder.

To add a compiler argument in Flex Builder, launch the Project Properties dialog box by selecting Project > Properties from the main menu, select the Flex Compiler option from the left menu, and type “-keep” at the end of the Additional compiler arguments text input field (see Figure 1).

Flex Builder Project Properties dialog box
Figure 1. Flex Builder Project Properties dialog box.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/08/02/viewing-a-flex-applications-generated-source-code/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">

    <mx:Label text="Right click this Flex application and select 'View Source' to view generated source code." />

</mx:Application>

View source is enabled in the following example.

The generated source code will appear in a /generated/ folder within the Flex Builder project’s /src/ folder. If your MXML file was named main.mxml, the generated file could be found at /generated/main-generated.as.

{ 3 comments… read them below or add one }

1 abhishek September 21, 2008 at 10:36 pm

hello,
i’m not use tht -keep option , but still i store bin-release folder at server side then also i’m able to see tht source code with right click option, we can also use while export file, Enable View Source check box is to clicked ,
:)

Reply

2 abhishek June 24, 2009 at 3:05 am

hey..cn u plz help me..i gt a prblm here
i am a beginner..trying to help my teacher out
she has to get some pics in the flex program ..hw do i do it ?
we are using flex 2.3

Reply

3 Sam February 8, 2010 at 1:15 am

Hello Abhishek,can u describe ur actual problem.
Thanks

Reply

Leave a Comment

Sorry, this blog is terrible at eating HTML comments.
If you're pasting any HTML/XML/MXML code, you need to convert your < characters to &lt; and your > characters to &gt; .

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Anti-Spam Protection by WP-SpamFree

Previous post:

Next post: