Publishing an FLA through JSFL
16 09 2003After reading Mike Chambers’ post on executing JSFL files from the command line I decided to do some experiments.
Building on that concept I came up with a little script that opens up an FLA, adds some ActionScript and exports it. You can download the files here (be sure to change the path in the JSFL file to point to the correct locations of your FLA and SWF).
publishFLA.jsfl
fl.openDocument(”file:///C:/publishFLA.fla”);
var myDoc_doc = fl.getDocumentDOM();
var myTimeline_tl = myDoc_doc.getTimeline();
var myFrame_frame = myTimeline_tl.layers[0].frames[myTimeline_tl.currentFrame];
myFrame_frame.actionScript = “jsfl_txt.text =”This text was added through JSFL!”;”;
myDoc_doc.exportSWF(”file:///C:/publishFLA.swf”,true);
myDoc_doc.close(false);
Nothing very fancy in itself, but ofcourse the potential is practically limitless. Imagine creating new SWF files on the fly through a dynamically generated JSFL script. I’m very excited about those developments which may - who knows - even pave the way for a form of Flash Markup Language.
Hope to have more examples up in a little while!






actually…i wrote about that awhile ago. i have a little tool that creates a ‘publish’ jsfl that goes through a directory and finds all the FLAs. Then to publish all the files, you just have to double click on the jsfl file, and Flash will happily export everything, thus similating a ‘compile’ session.
i ran it on a 164 kb jsfl file, containing hundreds of FLA’s and it ran smooth and flawless.
Hi there.
I’m wondering if you know a way that I can launch an SWF after I’ve used exportSWF to publish it. I am trying to mimmick the behavior of “Test Movie” but I can’t find a way to open the exported SWF in the flash environment.