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.

Creative Commons License

This work is licensed under a Creative Commons License.

7 thoughts on “Adding a View Source Menu to Flex Applications

  1. 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)
    = Application.application.className
    + “”;
    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).

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

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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s