Two weeks ago I met some friends of mine also involved in RIAs like me and the Flex Ant Tasks were one of the topics of our discussion. Then I decided to blog about it.

I’ve googled many times on this subject. The documentantion from Adobe is very basic. On the web you can find many snippets of code, but then it’s difficult to find a working project.

Now the quest is over! You can find a complete project here ;)

Unzip it. Then start Eclipse and go to File->Import->From FileSystem

The project is based on:

The Flex Ant Task and Ant-Contrib jars must already be present in the ant lib directory or in a .ant/lib directory inside your home dir. If the Ant-Contrib lib jar referenced in build.xml is not loaded, then add it on your eclipse ant classpath following these steps:

  • right click on build.xml
  • select “run as -> Ant build…”
  • select ant “classpath” tab
  • On “additional task” add antcontrib jar

Now, just launch the compile target and the project will be compiled.

The project contains a ”classes” directory where I put all my AS3 classes, a “libs” directory where you can add all your external swc libraries and a mxml directory with all the mxml source. If you need to change the names of these directories, you can do so by editing the included build.properties file.
I like Flex modules because they are easy to understand. With this ant task you can use the “optimize”  module (just add it to the mxml/module directory). What does optimize mean? An optimize module shares classes already loaded from a main swf.

This way you can reduce your application size and manage it with ant! :)



   
































 
 


 


   
   
   








	
	
	
	 
	 

	 
	 
	 
	 

	
	
	
	









 




 








  












Leave a Reply

Name Email Website URI