mike chambers | about

Adding a View Source Menu item to Macromedia Flash Content

Thursday, April 7, 2005

Yesterday [Lawrence Lessig][1] gave a talk at the FlashForward conference titled [The Cost of Copyright][2]. 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][3], [layer 51][4]). 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: ``` #include viewFlashSource.as</pre> ``` You can then specify the source URL through the flashParams HTML 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. ``` xml ``` You can download the source and example [here][5]. 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][6] 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. [1]: http://www.lessig.org/blog/ [2]: http://www.flashforwardconference.com/default.asp?Location=15,120,673,849&ItemID=422&SessionID={8E315B32-F643-4AE6-A921-FC012688B9AF} [3]: http://www.flashkit.com [4]: http://proto.layer51.com/default.aspx [5]: /mesh/files/viewflashsource/viewFlashSource.zip [6]: http://www.creativecommons.org
twitter github flickr behance