Adding a View Source Menu to Flex Applications
There is one thing that has continually impressed me about the Flash community: its willingness and dedication to helping one another. This weekend at FlashForward San Francisco, Lawrence Lessig encouraged the community to further adopt this culture of sharing and expressed his belief on how innovation is dependent upon this culture.
Yesterday, at the keynote, Kevin Lynch further reiterated this idea and showed off a script that Mike Chambers put together while we were sitting in the balcony watching the presentation. Then, when we were at the airport, on our way out here to Flash in the Can, I decided to build a Flex version of this.
So, here it is! Although this is simple, it should allow you to quickly specify a ‘View Source’ and a ‘View License’ menu in your Flex applications. The functionality is pretty basic at the moment, but I hope to expand this in the future.
Here is the menu in action:
I have exposed the functionality as a custom Flex tag. To see how to use this, check out the Example.mxml file in the zip.
This work is licensed under a Creative Commons License.

If you override the initialized() in the ViewSourceMenu class, gotoURL defaults to the MXML file name appended with a “.zip”:
function initialized( document:Object, id:String ):Void
{
if (gotoURL == undefined)
{
gotoURL
= Application.application.className
+ “.mxml.zip”;
}
super.initialized(document, id);
}
So one needn’t specify a gotoURL, just follow the naming convention.
Another option for viewing the MXML source directly in an editor (more like HTML) would be to set up a Java servlet to return the MXML file in source form (content-type xml).
Manish Jethani
9 Apr 05 at 10:46 am
This standalone application was created with the Developer edition of Macromedia Flex and has expired. Contact the author of this application for a new copy.
roberto
10 Apr 05 at 6:31 pm
Manish: Good info. The servlet that returns the MXML is definitely something that I was thinking about. It would be a great addition. Hopefully I will have time to add the servlet this week.
roberto: Should be fixed now. Thanks for catching that.
Daniel Dura
11 Apr 05 at 9:53 am
Hi,
You can look into Flex explorer,how it shows the MXML source? I guess, you don’t need to write a servet either.
-abdul
Abdul Qabiz
2 May 05 at 1:53 pm
mise a jour norton
Mise a jour norton
27 Aug 05 at 4:16 pm
vous avez fait un très grand travail sur ce site
Robert Poke
2 Sep 05 at 5:52 pm
me ha gustado su pagina, yo tengo un sitio dedicado a la memoria de Ernest Hemingway, me gustaria que vosotros lo visitaras y me dieras su opinion, gracias.
Samuel Clepinsky
22 Sep 05 at 7:52 pm