I don't know much about ant and I'm having trouble finding an example where I just copy a swf after it is compiled in flashbuilder. I'm working with a very small swf and I have it set to "build automatically" since the compile time is < .5 sec.
I'd like to shorten the length of my test cycles and I'm hoping to automate moving a file to a folder so I can test the swf in my application. I only need the file moved when built since that folder auto-uploads anything added to it. What's the path of least resistance to this automated copy using ant-build.xml? Is this a simple process or is there a lot of overhead to make this work? (This is a pure actionscript project imported into a larger application, not flex). Is this even possible with pure as?
This is a very simple build.xml for Ant, which compiles your MXML application and copies the SWF to a specific folder. Put it into your projects' root folder and replace bin-release
with your desired export folder. Also adjust the path to your Flex SDK as well as to flexTasks.jar
and Application.mxml
.
<?xml version="1.0" encoding="utf-8"?>
<project name="Builder" basedir="." default="build">
<target name="init">
<property name="FLEX_HOME" value="C:/Program Files/Adobe/Adobe Flash Builder 4.6/sdks/4.6.0" />
<taskdef resource="flexTasks.tasks" classpath="${basedir}/libs/flexTasks.jar" />
</target>
<target name="compile">
<mxmlc file="${basedir}/src/Application.mxml"
output="app.swf"
keep-generated-actionscript="false"
optimize="true">
<source-path path-element="${basedir}/src" />
</mxmlc>
</target>
<target name="export">
<copy file="app.swf" todir="bin-release" />
</target>
<target name="build" depends="init, compile, export" />
You can run this build.xml automatically if you add an Ant builder under Project properties
- Builders
.