Adding a View Source Menu item to Macromedia Flash Content

Yesterday Lawrence Lessig gave a talk at the FlashForward conference titled The Cost of Copyright. In it, he stressed the importance and necessity of a culture of sharing. Of course, the Flash community has grown up on this culture (i.e. FlashKit, layer 51). However, all of the sharing usually goes on on a developer to developer level, as you cannot easily get the source from Flash content.

So, during the FlashForward keynote this morning, I put together a simple library that allows you to add a view source Menu item to your Flash content. This makes it easy to allow other developers and designers to view the source for your content (if you want them to be able to).

Updated : I have updated the code and examples to allow allow you to specify a link to the license for the Flash content.

Here is an example:


Just right click on the Flash movie and select the View Source Menu item. This will allow you to download the source code.In this case I have Zipped up all of the files including the FLA, but I could also link directly to an ActionScript text file, or another HTML page that links to the source.Usage :Place the viewFlashSource.as file in the same directory as your Flash source file (FLA), and add the following line to the main timeline of your source file:[code]#include viewFlashSource.as[/code]You can then specify the source URL through the flashParamsHTML tag / attribute.There are two values you can specify:flashSource : Points to a URL to download the source for the contnet.contentLicense : Points to the distribution / re-use license for the content.[code][/code]You can download the source and example here.I put this together pretty quckly so I am sure there are tons of ways it can be improved. I am sure that the Flash Community will be able to make this a lot better, so I am releasing this under a creative commons license.I know that the CC licenses are normally not code oriented, but they are so clear and easy to understand, I decided to use it anyways.Creative Commons License
This work is licensed under a Creative Commons License.<!—->