Locking FLA’s under version control

We’ve recently moved over to SVN as our version control system. This system, among other features allows you to request a lock on specific files checked out from the version control system. This means nobody else on your team can check that file in until you have either finished editing and checked it in, or released the lock.

When it comes to FLA files this is great, as unlike actionscript source code, FLA files cannot be automatically merged and so having two people working on the same FLA at the same time creates all kinds of problems, with lost hours, and even lost work.

The problem with optional locking, is that you may not know a file has been locked until you go to check it in, at which point you may have worked on it for hours and so we are presented with the same problem, having to manually merge two versions of the same FLA file.

SVN solves this by allowing you to set the property svn:needs-lock on any file. This means that when a user checks the file out they receive it as read only, and to make it writeable they need to request a lock for the file, at which point their SVN client notifies them that somebody else has the file locked so they need to request that person checks the file in. It also allows you to set auto-props, which are properties to apply to all files of a certain type that are checked into the system. In our case any .FLA files.

This falls down in one respect though. If you are not opening the file from windows explorer (in the case of tortoiseSVN) where you would see the grey icon indicating that a file is read only, but rather from your IDEs recent documents menu, or from a tool that provides a different view to the file system such as FlashDevelop, it relies on whatever tool you use to edit that file telling you that a file is read only. Unfortunately Flash does not warn you when you open a read only FLA. It just opens the “save as” dialog when you try to save the file. This a potential point where you could be facing a file merge, or even worse, lost work.

To get around this I’ve put together a JSFL script that detects when you open a file and examines it’s properties for the read only attribute, then pops up a warning to get a lock from SVN before working on it. Hope people out there find this useful. To use it you need to save it to C:Documents and SettingsusernameLocal SettingsApplication DataAdobeFlash CS3enConfigurationToolscheckReadOnly.jsfl

you can download it here

* Check read only script
* Warns you about opening read only files in Flash IDE
* By Phil Douglas 2008
* www.lookmumimontheinternet.com
trace = fl.outputPanel.trace;
function onDocumentOpened(){
var currentDoc = fl.getDocumentDOM();
nativePath = currentDoc.path;
uriPath = nativePath.split(':').join('|');
uriPath = uriPath.split("").join("/");
uriPath = 'file:///'+uriPath
attributes = FLfile.getAttributes(uriPath)
alert('This file is read only. If it is in SVN you should request a lock before working on it.');
fl.removeEventListener("documentOpened", onDocumentOpened);
fl.addEventListener("documentOpened", onDocumentOpened);
  1. #1 by Gabriel on April 17th, 2008 - 9:50 pm

    Switch to PerForce, it’s infintely better than SVN. Luckily i started out on Perforce at work. Then tried to setup an SVN and hated it. And now at my current job, using Visual Source Safe, i can only dream of being able to use Perforce again.

  2. #2 by akeem on April 17th, 2008 - 10:22 pm

    We also recently switched to svn at my job and this is great info. WIll try the jsfl thanks!

  3. #3 by Phil on April 18th, 2008 - 12:12 am

    Hey Gabriel

    If you’re having problems getting an SVN server set up, I recommend visualSVN. You pretty much just install it and you’re done.


    SVN was a good option for us because our old repository was CVS and there are tools available to easily convert the whole repository to SVN.

    Also Perforce is a bit pricey and from what i saw lacks a windows shell client like tortoise, although i may be wrong on this.

  1. No trackbacks yet.

Comments are closed.

  • SetPageWidth