June 24, 2008

Application Version Control in AS3

Filed under: ActionScript, Bug Fixes, Flex, Japanese — Anthony @ 2:23 am

I thought that I would just write a quick note on how I know which version of an application I am looking at when it has been published to the web. It's all well and good saying its revision 87 from svn but how do you know? Well a simple way is to add it to the Flashplayers custom context menu. Right click to see the custom menu and to view the source

This comprises of making just two files one of which is a singleton class that can be used for every project you want to add version control to and the second is a VersionControl.properties file which you update before you publish a new version of your application lets take a look at that file first

#Each item takes the same params as the ContextMenuItem class
#and is seperated by and & ampersand
#caption:String = caption Value : String,
#separatorBefore:Boolean = false,
#enabled:Boolean = true,
#visible:Boolean = true
#In addition each item supports a url variable just add
#&YOUR URL GOES HERE;
Version=Version 0.1&false&false&true;
url=Developer:A McCormick&false&true&true&www.goeshere.com
viewSource=ViewSource&false&true&true&www.goeshere.com

The Second class controls what these properties do i know its a long class but its fully commented. ( right click the grey square above and choose view source to see the VersionController class ).
Basically it loops through the VersionControl.properties file and builds context menu items based on the values, adding the ability to include links as well.
And finally all you have to do is call getInstance( this ); in your main application file.

<!--[CDATA[
 
			import VersionControl.VersionController;
 
		]]-->

3 Comments »

  1. Excellent ! Thank you.
    What happens if the “default” context menu is disabled or already fully customized ?

    Comment by Arnaud — July 2, 2008 @ 10:34 am

  2. Well you can’t fully disable the context menu in Flash without using some third party scripting, as for fully customized context menu’s i’m not sure..

    Comment by Anthony — July 7, 2008 @ 1:59 pm

  3. [...] Application Version Control in AS3 Posted Julho 29, 2008 Filed under: Examples | http://www.betadesigns.co.uk/Blog/2008/06/24/application-version-control-in-as3/ [...]

    Pingback by Application Version Control in AS3 « Rflex’s Weblog — July 29, 2008 @ 2:50 pm

RSS feed for comments on this post. | TrackBack URI

Leave a comment

XHTML ( You can use these tags): <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .