Using ANT to compile Flex files

Hi All,

The below example will show how to use ANT to compile Flex files to generate .SWF files.

Step 1: Install FLEX SDK3.1   e.g   c:/flex3.1

Step 2: Create a build.xml    e.g. build.xml

Step 3: Add the below ant task defination  in the Build.xml
<taskdef resource=”flexTasks.tasks” classpath=”c:/flex3.1/ant/lib/flexTasks.jar”/>

Step 4: Crate an Ant Task
<target name=”compileFlex”>
<mxmlc file=”/flex/src/Index.mxml”
incremental=”true”
debug=”false”
optimize=”true”
warnings=”false”
services=”flex/services-config.xml”
output=”build/project/view/index.swf”
classpath=”c:/flex3.1/ant/lib/flexTasks.jar”>
<load-config filename=”c:/flex3.1/frameworks/flex-config.xml”/>
<compiler.library-path dir=”lib/swc” append=”true”>
<include name=”*.swc” />
</compiler.library-path>

</mxmlc>

</target>

Thanks

R Vashi.

2 thoughts on “Using ANT to compile Flex files

  1. Rakesh

    Can we do this without installing the Flex SDK ? I have only the Flex Builder 3.0 installed in my machine.

    Reply
    1. ®V Post author

      Hi Rakesh,

      Flex SDK is required. But if you have Flex 3.0 installed then you can use the SDK from there which comes with Flex builder.

      You can find it in the below Home location of Flex Builder
      C:\Program Files\Adobe\Flex Builder 3\sdks\3.0.0

      Thanks
      R Vashi.

      Reply

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.