From Flex builder select project -> Publish application source.
Dialog box for selecting the source elements will open. By default, all project source code and assets are selected, but you can specify at your own.
If the main application is an MXML file, flex builder automatically adds the necessary code to enable the view source context menu item.
If you want to manually enable theat item, you should add the viewSourceURL attribute to the <mx:Application> tag such that it points to the index.html page in the published source code directory.
If the main application is an AS file, you'll have to enable the context menu item using AS code. this step requires the com.adobe.viewsource.ViewSource class .You should then call the static addMenuItem() method , passing it a reference to the main class instance and the URL for the source code, like so: