elimak

Tutorial: Compile your AS3 projects with Ant + Flex SDK (all Open Source)

How to Install Ant on a Windows OS in order to compile your AS3 Projects.
Working with this setup will allow you to work independently of your code editor.
Therefore, your projects can be easily opened into any editor and being compiled without the need of the Flash IDE.

———————————————————————————————————
INSTALL YOUR RESOURCES:
———————————————————————————————————

1 – Download the resources:

* Download Ant
* Flex SDK
* tools.jar ( zip )

Unzip Ant.zip and Flex SDK under your main drive:

C:/ant
C:/flex_sdk_3_3 ( if your version is 3.3 )

Unzip tools.zip in the “lib” folder of your java JRE
in my case the path looks like: C:/Program Files/Java/jre6/lib

2 -Add the path of ant into your environment variables:

In order to make ant available for your compilation, you must add its path to the environment variables
* Open the System Properties.
* Select the “Advanced” tab and click on “Environment Variables”.
acces_environmentpath

This will open a new Window. On the bottom list of this window:
* Scroll down and find the “Path” properties.
* Select it and click “Edit”.
acces_environmentpath2

Add “C:antbin;” (whitout quotes).
acces_environmentpath3

3 – Restart windows!

———————————————————————————————————
TEST YOUR FIRST PROJECT COMPILED WITH ANT!
———————————————————————————————————

You can download this small project compile_with_ant.zip

In order to compile your AS3 class(es) you need to configue the build.properties and the build.xml

Make sure that your project properties point properly to your source and output.
Make sure that you have the proper path to the flex sdk.

To compile your resource, open the prompt:
* Go to Windows menu “Start”
* Select “Run”
* Type “cmd” + press Enter

When your prompt is open, go to the location of your project, then type ant and your project will compile.
prompt

———————————————————————————————————
CONCLUSION:
———————————————————————————————————

This installationcan feel a bit complicated but remember that you will do it only once, and that it will open more flexiibility that you would have expected.
Using FlashDevelop as editor is a good way to avoid dealing with the navigation inside the prompt.
Many people have several drives and sometimes the path of a project can be quite long to target.

When you are inside FlashDevelop, open your build file, and click the prompt icon on the top bar -> this will open the prompt with the proper path of your project.
prompt_infd

6 Comments

    hi dude
    thx for the post…

    stupid you’re link aint working shit on …

  • Sorry, it was pointing on a website that I am not hosting anymore. I updated the links.
    Cheers!

  • hey bholo, it’s not a dude !!

    not every geek in the world is a dude !!!!!

    look closer !

  • Indeed. Thx you for the comment, that just made me smile :)

  • super. easy and more clear to understand. thanks.

  • [...] 英文原文:http://www.blog.elimak.com/2009/07/tutorial/ [...]

Leave a Reply

You must be logged in to post a comment.