moock.org is supported in part by


September 23, 2003

export a .swf from the command line

using Flash MX 2004's new JSFL authoring-tool scripting language, you can now export a .swf file directly from the command line. unfortunately, the authoring tool will launch to do the export, but you can quit it automatically once it's done. here's a quickie code sample to show how it works:

Code in exportPetSupplies.jsfl:
===============================
// Open the .fla file.
var doc = fl.openDocument("file:///c|/data/projects/pet/petsupplies.fla");
// Export the .swf file.
doc.exportSWF("file:///c|/data/projects/pet/petsupplies.swf", true);
// Quit the Flash MX 2004 authoring tool (optional).
fl.quit(false);

Command issued on command-line from /pet/ directory:
======================================
"c:\program files\macromedia\flash mx 2004\flash.exe" exportPetSupplies.jsfl

now that's darn cool. it lets you add .swf compilation into a build tool like Apache Ant. sweet.

Posted by moock at September 23, 2003 01:39 PM
Comments

For Mac users can you translate for a unix terminal?

Posted by: steve at September 24, 2003 08:59 AM

nice...BUT, it takes a while for the authoring tool to open...

Posted by: rob at September 24, 2003 07:56 AM

Owen van Dijk just released JSFLCreator that does this automatically. See http://www.swfoo.com/

Posted by: Dave Yang at September 23, 2003 09:45 PM

this, used with flashstudio PRO could be very very very nice :D

Posted by: argonauta at September 23, 2003 04:21 PM

x?

Posted by: x at September 23, 2003 04:01 PM

how about specifying the swf and fla from commandline also? and put all of it in a batch file to get rid of the jsfl call

Posted by: coby at September 23, 2003 04:00 PM

Does not seem to work if MX04 is already open but if it is closed works like a charm. Getting closer to Generator every day.

Posted by: Lar at September 23, 2003 02:09 PM