Showing posts with label Ant. Show all posts
Showing posts with label Ant. Show all posts

Friday, August 27, 2010

Part 1.3 Getting ANT up and running

We are now going to compile our little Hello World application. Normally we'd be using Flex Builder for this, choosing build from the context menu or CTRL-B-ing our way to some fun. Remember however that we don't want to use FB for compilation so we are going for a proper build system approach.
On the surface this seems like a lot of work for something FB can achieve for us very simply, but as we'll discover the further we get through these tutorials, it becomes a very powerful tool in our hands. Hopefully you'll use these powers for good rather than evil...
I'm actually going to provide the build file this time, and then we are going to work our way through it. I'm not going to provide a full set of learning ANT documentation, there is plenty of that out there if you are interested.


  • Turn off every "build before..." setting you can find in FB, they slow things down and through off what we want to deploy!
  • Add another folder to your setup folder called build, and under that add a file called build.xml.
  • Make sure the FLEX_HOME environment variable is set to the Flex SDK you want to use.
  • Grab the Flex Tasks jar file from your SDK folder and place it into the libs directory of your project.
Here's the code we're going to be adding to the build file. This is a pretty simple file, and doesn't include many if any of the optimizations and tweaks that ANT provides.

We now need to get this running.


  • Open the ANT view in Flex Builder. You should have this already installed if you've followed the previous parts of the tutorial.
  • Choose to add a buildfile and choose the projects buildfile
We should see the below.
Double click the compile target, and assuming everything has been set up properly, the SWF will be generated in the target directory.
We can clean the folder structure back up by running the clean task, ready to be committed to source control once we are satisfied that the code works.