Flex & Version control

Flex & Version control

Ever had a project where your client has some kind of odd/unusual caching issue with their servers that you have absoulutly zero control over?

Well if you have (which I have had) then the following swc file may help you to diagnose the problem. Its a very simple swc file that you can place inside your code and pass it a version number. Next time you build your app and deploy it to your clients servers you can type ‘version’ then whatever number you gave inside your code will appear inside an Alert box.

This has helped me sooooo many times, as after deploying some code, if they (client) appear to be seeing something different to what I’m seeing then I can get them to type ‘version’ and if it’s the old version number I have to tell them to clear their cache & wait for their internal servers to refresh (again I/they have no control over this), then a few hours later they will have the correct version.

So it just helps when you roll out a minor update and you say its fixed, then they come back and say that they can’t see the changes, you can then show that its the internal hardware and that they just have to wait to get the new swf.

As a little extra feature on the version SWC I’ve given it the ability to listen to your own functions should you wish. It works by listening to the keypress event on the stage (so their is nothing visual to worry about). By default the version number is shown by typing ‘version’ when the app has focus. If you wished it to do something else on a certain word or set of key presses (a-z, 0-9) then you would do the following:


//There is a addKeyListenerFunction and a removeKeyListenerFunction
addKeyListenerFunction('whateverSetOfKeyPressesYouWantToListenTo', someFunction);
//remove listener by passing in the word that you where listening for
removeKeyListenerFunction('whateverSetOfKeyPressesYouWantToListenTo'); 

Click here for runnable demo, right click for source code. (just make sure app has focus for it to work)

If you’re interested in file size, using the above example with and without the version SWC changed the file size by just under 3K (3057 bytes).

The version SWC is case insensitive, so if you ask it to listen to HELLOWORLD, this is the same as helloworld.

Get the SWC file here.

[ad name=”ad-1″]

One Reply to “Flex & Version control”

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.