Specifications

183ADOBE FLEX 3
Building and Deploying Adobe Flex 3 Applications
<source-path path-element="${FLEX_HOME}/frameworks"/>
</mxmlc>
</target>
The following shows the complete example:
<?xml version="1.0" encoding="utf-8"?>
<!-- mySimpleBuild.xml -->
<project name="My App Builder" basedir=".">
<taskdef resource="flexTasks.tasks"
classpath="${basedir}/flexTasks/lib/flexTasks.jar"/>
<property name="FLEX_HOME" value="C:/flex/sdk"/>
<property name="APP_ROOT" value="myApp"/>
<target name="main">
<mxmlc file="${APP_ROOT}/Main.mxml" keep-generated-actionscript="true">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
</mxmlc>
</target>
</project>
This example shows how to use different types of options for the mxmlc task. You can specify the value of the
keep-generated-actionscript option as an attribute of the mxmlc task's tag because it does not take any
child tags. To specify the values of the
load-config and source-path options, you create child tags of the
mxmlc task's tag. For more information on using options, see Working with compiler options” on page 184.
4 Execute the Ant project, as shown in the following example:
> ant -buildfile mySimpleBuild.xml main
If you did not copy the flexTasks.jar file to Ant's lib directory as described in “Installation” on page 181, you
must include the JAR file by using Ant's
-lib option. For example:
> ant -lib c:/ant/lib/flexTasks.jar -buildfile mySimpleBuild.xml main
The output of these commands should be similar to the following:
Buildfile: mySimpleBuild.xml
main:
[mxmlc] Loading configuration file C:\flex\sdk\frameworks\flex-config.xml
[mxmlc] C:\myfiles\flex2\ant_tests\apps\Main.swf (150035 bytes)
BUILD SUCCESSFUL
Total time: 10 seconds
>