Archive for the ‘Error’ Category

Flash JSFL Utility

November 12, 2010 Leave a comment

Back to Flash world after long time. Everything is good.

I found this utility useful especially when working with multiple fla;s which needs to exported on every time when launching the game. Everything goes fine, until there is an compile time error while launching. If there’s one, then launching the game with errors seems of no use.

The Flash JSFL utility does by checking for errors., There is no direct way( Not sure if there;s one atleast as per my knowledge, if there’s some hacky way of getting around please post that in comments), so reading the output of the compile panel and saving it to a text file , reading that text file contents and checking if there is any error or warning against that output.

If there’s no error flash would output in certain way like

0 Error(s), 0 Warning(s)

Right here were the steps to get into that

var exportSWFs=new Array();




Push your sequence of swf’s into an array. The gameManager could be of an array with values formed from source path of the fla and destination where the swf needs to be published.

for (var i = 0; i < exportSWFs.length; i++)


var documentObj= fl.openDocument(exportSWFs[i][0]);


// creating a file name based on document

var docErrorURI= logDirURI + + “.errors”

// saving the contents of the errors;

// reading the contents of the error from file

var contents =;

// If there is no errors and warnings , it prints out like 0 Error(s), 0 Warning(s)

// getting errorCount from the above output; Not sure if regular expression works here

var errorCount = (contents.split(“Error(s)”)[0]).split(”)[(contents.split(“Error(s)”)[0]).length-2];


if (errorCount != “0”) {

// Dont want to continue with rest of export — I dont want to compile the fla with errors

success = false; break;

} }

if (success) {

// Do launch game here


alert(“There were errors in ” +;


Categories: Error, JSFL