There are plenty of tools out there to change the version information of a .swf file. However, I wanted to automate the process as part of my ANT build script, so I wrote a little Java class and ANT Macro to help me out.
You can download the .zip file here. Included in the .zip is the Java class and source code, as well as a sample ant build.xml showing how to use it. This is released under the MIT License.
Using the Java class inside of ANT is really simple:
<target name="updateVersion" >
<convertSwfVersion filename="MyApp.swf" version="8" />
</target>
<macrodef name="convertSwfVersion">
<attribute name="version" />
<attribute name="filename" />
<sequential>
<java classname="com.darronschall.SWFVersionConverter" fork="true" failonerror="true">
<!-- TODO: note the classpath here, you will probably need to change it -->
<classpath>
<pathelement location="flex/etc" />
</classpath>
<arg line="@{version} @{filename}" />
</java>
</sequential>
</macrodef>
The Java class is just a few lines. It simply seeks to the correct location in the .swf file and changes the header information. There's no error checking or anything, so use at your own risk.
A friend of mine had asked if I had written anything like this before. I knew that I had, and found it in my old archives after digging a bit, so I thought I'd put an open source license on it and make it available to everyone. If you find it useful, great. If not, well, at least I can find it easily by searching google instead of dusting off old archive CDs. :-)
Tags:
ANT,
Java,
Flex