May 132008

A couple of applications that really have helped my work flow a lot is Flashdevelop and TortoiseSVN.

For those of you not familiar with them Flashdevelop is an actionscript editor that integrates with MTASC or MXMLC compilers and swfmill to include assets into the project.
TortoiseSVN is a version control system which basically is a must on large projects and very handy even on smaller projects even if you are developing alone and just keep the repository on your local machine. TortoiseSVN also comes with a program called SubWCRev which we will use to write information about the current version into a textfile, which is handy so we can load it into our swf to display the current version.

First of all you need to download and install the applications if you don’t have them already.

Get Flashdevelop
Get TortoiseSVN

First step is to set up your “repository” and “working copy” directories.
I will not explain that part here since there is already many good guides on that subject, for example this pfd.
It is a little bit of an effort initially but I can assure you it’s energy well spent.


Now in Flashdevelop select Project->New Project in the menu to create a new AS2 or AS3 project in your working copy directory.
For example say we have created a working copy folder called “E:\_dev\Example”, you settings will look like this in the new project dialogue:

flashdevelop new project dialogue


Ok, so now we are all set up to actually integrate the SVN with our Flashdevelop project.
First of all create a new text file in your working directory and name it “build.bat”.
In it enter the following:


set TORTOISESVN_PATH=C:\Program Files\TortoiseSVN\bin

“%TORTOISESVN_PATH%\TortoiseProc.exe” /command:commit /path:”%CURRENT_PATH%\*”/logmsgfile:”%CURRENT_PATH%\logmsg.txt” /notempfile /closeonend:3

“%TORTOISESVN_PATH%\SubWCRev.exe” “%CURRENT_PATH%” “%CURRENT_PATH%\version.a” “%CURRENT_PATH%\version.txt”


Make sure that the “TORTOISESVN_PATH” is the same as the one you have installed TortoiseSVN to and save.
Basically what this batch file is doing is first to call TortoiseSVN telling it to commit changes and then calling SubWCRev to take the template for our version text (version.a) and use that to write a file that we will load into our app for displaying the version information (version.txt).

So we need to create a file called version.a containing the following text:

build=$WCREV$ ;
date="$WCDATE$" ;

The stuff between the $’s is what will be substituted by SubWCRev.
Here is a complete list of substitution keywords if you like to include more information, but usually the build number is all that I would use.
The major and minor version numbers one have to update by hand, at least to my knowledge.


Now in Flashdevelop go Project->Properties and open the “Build” tab.
In the “Post-Build Command Line” type: $(ProjectDir)\build.bat:
flashdevelop build settings
Now you are set up and each time you build in Flashdevelop you will get presented with a screen where you can enter a log message for the change if you like to commit it, or you can choose cancel and the change will not be committed.
If you like to have a default log message for the commit add a logmsg.txt in the working copy directory with the text you like to appear.


If you like to display the version information in your swf you have to load the version.txt and display the information. Here is an AS3 example:
package com.blixtsystems.utils {
import flash.text.TextField;
import flash.text.TextFieldAutoSize;
import flash.text.TextFormat;
* Class to display version information
* @author
public class ShowVersion {
private var _owner:Object;
public function ShowVersion(owner:Object) {
this._owner = owner;
private function loadTxt():void {
var loader:URLLoader = new URLLoader();
var request:URLRequest = new URLRequest(“version.txt”);
try {
} catch (error:Error) {
trace(“Unable to load version.txt.”);
private function configureListeners(dispatcher:IEventDispatcher):void {
dispatcher.addEventListener(Event.COMPLETE, completeHandler);
private function completeHandler(event:Event):void {
var loader:URLLoader = URLLoader(;
private function draw(data:Object):void {
var a:Array = data.split(“;”);
var major:String = a[0].split(“=”)[1];
var minor:String = a[1].split(“=”)[1];
var build:String = a[2].split(“=”)[1];

var tf:TextField = new TextField();
tf.autoSize = TextFieldAutoSize.LEFT;

var format:TextFormat = new TextFormat();
format.font = “Verdana”;
format.color = 0×000000;
format.size = 10;

tf.defaultTextFormat = format;
tf.text = major + “.” + minor + “.” + build;


That’s it, now every time you press F8 in Flashdevelop you will add any altered files to the repository and your swf will reflect the current version number!


Switch to our mobile site