Ant script for building Flash application

This is the ant script that i use for compiling my Flex application into .swf file

<?xml version="1.0" encoding="utf-8"?>
<project name="My App Builder" basedir=".">

<property name="FLEX_HOME" value="C:/software/AdobeFlashBuilder/sdks/4.0.0"/>
<property name="FLEX_MXML_PATH" value="C:/flex/HelloFlex/src/JSONDataExchange.mxml"/>
<property name="FLEX_SWF_PATH" value="C:/flex/HelloFlexPortlet/WebContent/HelloFlex.swf"/>

<taskdef resource="flexTasks.tasks" classpath="${FLEX_HOME}/ant/lib/flexTasks.jar"/>
<target name="main">
<mxmlc file="${FLEX_MXML_PATH}" keep-generated-actionscript="true" output="${FLEX_SWF_PATH}">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.library-path dir="${FLEX_HOME}/frameworks" append="true">
<include name="libs" />
<include name="../bundles/{locale}" />

You need to have either the Adobe Flex builder or the Flex SDK installed on your machine. This script requires following three variables

  1. FLEX_HOME Location where FLEX SDK is installed on your machine. If you have Flex builder 4.0, it has both SDK 4.0 and SDK 3.5 and you can point to either of them

  2. FLEX_MXML_PATHFully qualified path of the .mxml file that has your Flex application

  3. FLEX_SWF_PATHFully qualified path of the .swf file that you want to generate. In my case i am generating the .swf file inside my Web application so that i can package it in the .war file

No comments: