Thursday, July 31, 2008

Installing Flex 3 and Ant

Ant install:
Unzip "apache-ant-1.7.1-bin.zip"
into "C:\Program Files\"

Flex 3 SDK install:
Unzip "flex_sdk_3.zip" into "C:\Program Files\flex_sdk_3"

Copy the "C:\Program Files\flex_sdk_3\ant\lib\flexTasks.jar" into
"C:\Program Files\apache-ant-1.7.1\lib\"

Access the environment variables:
(Windows Key + Pause)
Go to the "Advance" tab then the "Environment Variables" button.

Create Environment Variables:
Create new variables called:

ANT_HOME
FLEX_HOME

With values of, respectively:

C:\Program Files\apache-ant-1.7.1
C:\Program Files\flex_sdk_3

Add to your path:
%ANT_HOME%\bin;%FLEX_HOME%\bin

Setup Flash Develop:
We have to tell Flash Develop where to look for the compiler.

Either hit F10 or traverse to Tools::Program Settings...
Select "AS3Context" on the left pane under "Plugins".
Under "Language" in the right pane, select and modify "Flex SDK Location".

For the purpose of this post it is "C:\Program Files\flex_sdk_3".

Under Project::Properties...
Select the "Output" tab.
Check the check box of "No output, only run pre/post build commands."

Select the "Build" tab.
Under the "Pre-Build Command Line" section add "ant.bat".
This is why we need the ANT_PATH variable.
Apply the changes.

When working on a project you ideally would have a "build.xml"
file in the root of your project. To build the project hit F8. This
will produce whatever the build file was told to do.

The FLEX_PATH allows ant to access mxmlc and compc executables.
Flex Tasks allows us to add compiler options as xml nodes. More on that here.

No comments: