<project name="My Flash Build" default="Compile and Launch" basedir="."> <property name="target_swf" value="my_movie.swf"/> <property name="main_class" value="MyClass.as"/> <property name="mtasc" location="C:\Program Files\hamtasc\mtasc.exe"/> <target name="Compile and Launch"> <antcall target="Compile Swf" /> <antcall target="Launch Swf" /> </target> <target name="Compile Swf"> <exec executable="${mtasc}" dir="." failonerror="true"> <arg line="-cp f:\"/> <arg line="-cp .\classes\"/> <arg line="-v -version 8 -mx -swf"/> <arg line="${target_swf} ${main_class}"/> </exec> </target> <target name="Launch Swf"> <dirname property="swf_path" file="${target_swf}"/> <fdt.viewDocument location="${swf_path}\${target_swf}"/> </target> </project>
target_swfproperty points to the swf you want to compile file, relative to the build.xml file.
main_classproperty points to a class. I haven't figured out why yet.
mtascproperty points to your mtasc compiler. It already should if you followed the instructions.
<exec>node, under the "Compile Swf" target, make sure you add any class paths you need. The path can absolute or relative to your project.
<arg line="-cp f:\"/> <arg line="-cp .\classes\"/>
<target name="Copy to Dev"> <copy file="${target_swf}" tofile="S:\dev\${target_swf}" overwrite="true" failonerror="true"/> </target>
<target name="Backup Swf"><!-- Make backups dir if needed --><mkdir dir="backups"/><!-- Increment build number --><buildnumber file="backups\build.number"/><!-- Get swf file name without swf extension and store it in the base_name property --><basename file="${target_swf}" property="base_name" suffix=".swf"/><!-- Copy swf to backups dir with build number --><copy file="${target_swf}" tofile="backups\${base_name}.${build.number}.swf" overwrite="false" failonerror="true"/> </target>
<target name="Compile in Flash"> <fdt.flashCompile> <fileset dir="."> <include name="${target_fla}"/> </fileset> </fdt.flashCompile> </target>Compile all fla's in a folder:
<target name="Compile in Flash"> <fdt.flashCompile> <fileset dir="."> <include name="*.fla"/> </fileset> </fdt.flashCompile> </target>