PDA

View Full Version : JSFL exportSWF Automation


metafocal
10-02-2007, 12:55 PM
For the true Guru,

Many of you may have seen this script for automating the export of SWF's from a folder containing multiple fla files. This script works very well on a small batch of files (<20). However I have over 6k worth of Flash assets to publish into SWF and PNG (exportPNG). When I run this JSFL script and point it to a folder containing over 20 assets, flash crashes. I have verified permissions on the folder (777).Can you assist?

var folder = fl.browseForFolderURL('Select folder containing files to batch export as *.SWF');
if (!null) {
var list = FLfile.listFolder(folder+'/*.fla', 'files');
//Create folder to hold exported SWFs
FLfile.createFolder(folder+'/Exported SWFS');
var flaName;
var swfName;
// Clear the output panel
fl.outputPanel.clear();
fl.outputPanel.trace('Batch Export SWF.jsfl LOG');
fl.outputPanel.trace('-------------------------');
fl.outputPanel.trace('Exporting all *.fla files in "'+folder+'" as *.swf\'s to "'+folder+'/Exported SWFS/"\n');
for (var i = 0; i<list.length; ++i) {
flaName = list[i];
swfName = list[i].split('.')[0]+'.swf';
fl.outputPanel.trace(flaName+' exported as '+swfName);
// open the document, publish to SWF, and close.
fl.openDocument(folder+'/'+flaName);
fl.getDocumentDOM().exportSWF(folder+'/Exported SWFS/'+swfName, true);
fl.closeDocument(fl.getDocumentDOM(), false);
}
// Save log
fl.outputPanel.save(folder+'/Exported SWFS/log.txt', false);
}

metafocal
10-03-2007, 06:30 PM
Well, I upgraded Flash to CS3 and the script works completly, apparently Flash 8 and a patch affectd the runtime of the jsfl when doing a folder list.

Not exactly sure, but it works.