AS3 Version Injection + Flex PMD + TDSI = Rock ‘n Roll! \m/

AS3 Version Injection

Ever been annoyed by Project Managers telling you that a bug you fixed is still in the latest release you did and after some investigation find out that they forgot to clear their cache? Well, fear not! An AS3 Version Injection script is here! 😛
I’ve created a simple AS3 class called Version that will add a time stamp to the context menu. All you need to do is instantiate the Version class once and pass it a reference to you Document Class. On top of the AS I’ve written a little Ant script that will take a template of the Version class, insert the current date and time and write out the Version class. This way you can just make it part of your Ant build and don’t need to worry about manually updating the version number. Also, now you’ll have a way of quickly identifying what version somebody is looking at. 🙂

Flex PMD

This is great for auditing your own code as well as other people’s code. I’ve written a small Ant task that can be ran as part of a build that will run your project through Flex PMD and create a PMD file for you. The PMD file will have a time stamp suffix so you don’t overwrite your old file and you can compare issues. To use this Ant script make sure you’ve downloaded PMD for Ant.

TDSI

Another piece of very useful technology. Up to 20% performance increase just by passing your SWF through it. I downloaded the Apparat source (where TDSI is part of) from Google Code and compiled it. Built another little Ant script to use TDSI with Ant. Just specify the input and the output file and you’re done!

Bringing it all together

All the above Ant scripts are saved in a separate file. This way I can import whatever piece I want in my build script, example:

  1. <import file="as3_version.xml" />

TIP: Place the import after you have defined your properties in the build script, this way the imported scripts can use the properties set in the build script.

Links

Leave a Reply

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