FlashAntTasks – Compiling Flash Movies With Ant
Sunday, April 26th, 2009If you’ve seen Mike Chambers flashcommand implementation you’ll notice that it only works on the mac. We have a lot of people at my office on Windows and I wanted to provide them something that could also work on a Windows computer. Plus I wanted something a little cleaner, easier to learn and a bit more elegant than most of the solutions out there. So I created FlashAntTasks. Its a jar file that you reference in your class file that creates flash tasks that compile separate movies. I’m posting it up on Google code so everyone can enjoy. So enough with the fluff, here’s the details
WINDOWS USERS – you need to pass in flashcommand the flashapp attribute with the uri to your flash.exe like
You can download the code at http://code.google.com/p/flashanttasks/.
<?xml version="1.0" encoding="UTF-8"?> <project name="FlashAntTasks" basedir="." default="Open in Browser"> <description> simple example build file </description> <!-- os specific properties --> <property name="os" value="${os.name}"/> <echo message="Using ${os.name}.properties"/> <property file="${os.name}.properties"/> <!-- Include the Flash Ant Tasks Jar here, also make sure you reference the FlashAntTasks.properties file which is bundled in the jar file --> <taskdef resource="FlashAntTasks.properties" classpath="lib/FlashAntTasks.jar"/> <!-- Project Specific Properties --> <property name="html.filename" value="index_full.html" /> <property name="local.path" value="${basedir}/wwwroot//${html.filename}" /> <!-- make sure to reference the fla dir and your output dir --> <property name="fla.dir" value="${basedir}/flash" /> <property name="swf.output.dir" value="${basedir}/wwwroot/assets/swfs" /> <!-- TARGETS --> <target name="Compile Additional Swfs"> <flashcommand > <movie export="true" source="${fla.dir}/site.fla" output="${swf.output.dir}/site.swf" /> <movie export="true" source="${fla.dir}/shared.fla" output="${swf.output.dir}/shared.swf" /> </flashcommand> </target> <target name="Compile Shell" depends="Compile Additional Swfs"> <flashcommand > <movie export="true" source="${fla.dir}/shell.fla" output="${swf.output.dir}/shell.swf" /> </flashcommand> </target> <target name="Windows Example" depends="Compile Additional Swfs"> <!-- WINDOWS USERS: flashapp attribute is required --> <flashcommand flashapp="c:\\Program files\\Adobe\\Flash.exe"> <movie test="true" source="${fla.dir}/shell.fla" output="${swf.output.dir}/shell.swf" /> </flashcommand> </target> <target name="Compile Shell" depends="Compile Additional Swfs"> <flashcommand > <movie export="true" source="${fla.dir}/shell.fla" output="${swf.output.dir}/shell.swf" /> </flashcommand> </target> <!-- Open in local browser --> <target name="Open in Browser" depends="Compile Shell"> <exec executable="open"> <arg line="-a ${browser} ${local.path}" /> </exec> </target> </project>