Usage

To use the flex2ant Ant task you need to create a new Eclipse project, create your ActionScript or MXML source files and supply a build.xml that holds the build tasks for Ant to perform the build of your swf. To compile, you would make one of your project files active and press SHIFT-ALT-X, let go and press Q.

This is what a basic flex2ant build script could look like:

<?xml version="1.0" encoding="ISO-8859-1"?>

<project name="myProject" basedir="." default="compile">

	<property name="src.dir" value="${basedir}/src" />
	<property name="bin.dir" value="${basedir}/bin" />

	<target name="compile" description="compiles the tasks">
		<mxmlc
			compiler="${mxmlc}"
			mainclass="${src.dir}/TheMainClass.as"
			sourcePath="${myPackage.dir};${basedir}/../../more/packages"
			as3="true"
			strict="true"
			output="${bin.dir}/myProject.swf"
			benchmark="false"
		/>
	</target>

</project>

As you can see this is a basic layout for an Ant build file. The first attribute given to the mxmlc task is the compiler value. This is the variable we added earlier to the properties tab of the Ant run-time settings (see installation for more information). This way we have some control over which compiler we use to compile our code with and most important we do not bound the build file to our specific system becuase your co-worker might have the Flex SDK installed in a different location.