Deploying Your SWF Files to a Different Source
One of the cool features of Ant is that you are not bound to only doing local development. You can also deploy and/or copy your files to a web server, FTP server, or a network share.
Let’s start with an inventory of what we need when we want to test on a web server:
An HTML file that embeds our SWF file
The JavaScript embed method via SWFObject (http://code.google.com/p/swfobject/)
A specific folder structure so that everything is neatly organized
That’s it! So what are we actually going to do? We have all the needed project properties defined in our property file. With those, we can build a directory structure and generate our actual HTML file. We do this with Ant so we don’t have to do it by hand for every project we do. This is a huge time-saver!
We are actually going to change our build files a little bit. Because deploying is a different process than compiling and debugging, I prefer to work in a different file called deploy.xml.
The benefit of using separate files is that the functionality defined in the filename is neatly encapsulated in one file—there’s no searching required, since the name says it all. Each file can be easily distributed to freelancers or colleagues who are setting up the builds on their machines.
Let’s start editing our build.xml file, and strip out everything except loading Growl, loading our properties, and creating the timestamp target:
<?xml version="1.0" encoding="UTF-8"?> <project name="Main Build file" basedir="."> ...