Skip to content

Automating Flash CS4 builds with JSFL

2010 September 7
by Tedb0t

I use and adore Flash Builder for programming Flash applications, but there are occasions where you have to compile from the Flash IDE.  On a current project I have multiple FLA files that have to be compiled and copied to a development server in order to test them, so I wrote a script (well, two scripts) that automates this completely using Flash’s Javascript API (JSFL).

The compile-all.jsfl script publishes each document open in the IDE and then writes a log file to signal that it’s done compiling (which is the only way I could find to tell bash it’s done).  The build.sh script removes the file first if it exists, starts the JSFL script, waits for the logfile to appear, then runs another script that copies the SWFs to the dev server.  Now to find out how to integrate this script into FB…

compile-all.jsfl:

for (doc in fl.documents) {
	fl.documents[doc].publish();
}
FLfile.write("file:///Users/daleth/Projects/Oddcast/Avon/log.txt", "nothing");

build.sh:

#!/bin/bash

if [ -f log.txt ]
then
	rm log.txt
fi

open compile.jsfl

echo "Compiling..."

while [ ! -f log.txt ]
do
	sleep 1
done

echo "Finished compiling, copying"

./update.sh

Related Posts:


Leave a Reply

Note: You can use basic XHTML in your comments. Your email address will never be published.

Subscribe to this comment feed via RSS