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).
Figure 1. Flex Builder Project Properties dialog box.
Full code after the jump.
<?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.