Viewing a Flex application’s generated source code

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.

5 thoughts on “Viewing a Flex application’s generated source code

  1. 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 ,
    :)

  2. 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

  3. Why a Flex Project is bigger in size than ActionScript Project and How can I minimize the size of a Flex Project?

Comments are closed.