I’ve just updated my JSFL batch compiler. It will now also output any compiling errors to the log file (though it can’t detect them outright, so the error message might not show if your only errors are compiling errors generated by Flash). Thanks to Keith Peters (bit101) for the heads up on outputPanel.save()!
I also made the logging a little easier to read, and fixed the title on the file selection dialog, just special for Stacey (aka BitchWhoCodes).
You can download the latest by clicking here. Documentation is here.
Sample log:
Running compile on 3 files at: _____/flash/compileProject/
—————————————————————————
Compiling core.fla
—————————————————————————
>> ERROR: Could not set publish profile (testProfile): core.fla
Compiled core.fla successfully.
Moved core.swf to swfs/core.swf successfully.
—————————————————————————
Compiling assets/asset1.fla
—————————————————————————
Compiled assets/asset1.fla successfully.
Moved assets/asset1.swf to swfs/assets/one.swf successfully.
—————————————————————————
Compiling assets/asset2.fla
—————————————————————————
**Error** Symbol=brokenLinkage, layer=Layer 1, frame=1:Line 1: The class ‘MissingClass’ could not be loaded.
Total ActionScript Errors: 1 Reported Errors: 1
Compiled assets/asset2.fla successfully.
Moved assets/asset2.swf to swfs/assets/two.swf successfully.
PS. Post number 100, in just under 1 year. Yay! 🙂
Cool script Grant =)!
Just one question…I´m not sure, but shouldn´t this line
if (schemaURI.substr(schemaURI.length-5) == “.txt”) {…}
be
if (schemaURI.substr(schemaURI.length-4) != “.txt”) {…} ?
Cool Script Grant!
I think it´s time for me to read in a little bit in JSFL – looks pretty useful..=)
Just one question:
Shouldn´t this line
if (schemaURI.substr(schemaURI.length-5) == “.txt”) { alert(“>> ERROR: Selected schema is not a .txt file.”); return; }
be
if (schemaURI.substr(schemaURI.length-4) != “.txt”) { alert(“>> ERROR: Selected schema is not a .txt file.”); return; }
greez
a
ripcurlx
good catch – fixed and uploaded again.
Cheers.
you tha man!
but your documentation link above is 404
Whoops… fixed the link.
A made a little enhancement, but actually it´s just for windows user:
If the folder, which are specified don´t exit they are created.
…
function move(p_file,p_newName,p_fileName) {
// delete old already compiled swf:
FLfile.remove(p_newName);
var ok = checkDirectories(p_newName);
…
function checkDirectories(filePath) {
// check the first characters containing partition information
var part = filePath.substr(0,10);
// if partition doesn´t exists
if(!FLfile.exists(part)) {
appendToLog(“>> ERROR: partition (“+part+”) doesn´t exist.”);
return false
}
//seperate directories
var arr = filePath.split(“/”);
var l = arr.length-1;
for(i=4;i> ERROR: created directory (“+part+”) because it doesn´t exist.”);
FLfile.createFolder(part);
}
}
return true;
}
greez
this file is fantastic and helped me no end … reacently i installed a fresh version of your site and am now unable to run.. am getting the error msg.”ReferenceError: FLfile is not defined”
any info you can give to solve this problem would be fantastic as i miss having this running well.
thanks
We are also having problems now running the script. I had previously used this without incident, but I had provided this to a co-worker and he is unable to get it to run. getting the following message as previous post, “ReferenceError: FLfile is not defined”. Any help or suggestion greatly appreciated, this is a great script and had previously helped me out tremendously, but can’t see why it no longer runs.
Kurt: This extension requires the 7.2 update found at http://www.macromedia.com/support/flash/downloads.html
Grant,
I’m testing your JSFL batch compiler and ran into a couple issues. First, I get “Running compile on undefined files at…” It says undefined because you have startLog(“Running…” +l+ “…”); before var l is defined.
Second, if you are placing your SWFs in a different location than the FLA the line if (!FLfile.exists(dirURI+swfName)) will append “>> ERROR: File did not compile correctly: ” even if it compiled correctly. Without testing I believe
var swfName = flaName.substr(0,flaName.lastIndexOf(“.”)+1)+”swf”;
should be
var swfName = (row[1] != undefined) ? row[1] : flaName.substr(0,flaName.lastIndexOf(“.”)+1)+”swf”;
What you’ve done here is a godsend. Thanks!
Really nice work Grant!
I’m running into couple of issues with this script running on Flash 8.
First of 1 question: has anyone attempted the last change by Chris suggested above when placing the SWF’s in a different location
2nd: I’m running into issues batch compiling 100’s of files (if not 1000’s) & i get a pop up “While executing in , a JavaScript error occured”.
And the output window shows a message “Cannot find file file:///…..xxx.fla”
I have confirmed that the file does exist. I can open the file in Flash 8 & publish it manually without any issues.
The publish profile error can be resolved by simply changing row[1] to row[2] in the call to compile function.
row[1] corresponds to the swf file, row[2] contains the publish profile info.
See snippet below to get the idea
.
.
if (!FLfile.exists(dirURI+flaName)) { appendToLog(“>> ERROR: FLA not found: “+flaName); error=true; continue; }
compile(dirURI+flaName,row[2],flaName);
.
.
Also you can add custom publish profile by importing them in jsfl see snippet below for usage
.
. doc.importPublishProfile(“file:///C:/Documents and Settings/user/Local Settings/Application Data/Macromedia/Flash 8/en/Configuration/Publish Profiles/flash7.xml”);
doc.currentPublishProfile = p_profile;
if (doc.currentPublishProfile != p_profile) { appendToLog(“>> ERROR: Could not set publish profile (“+p_profile+”): “+p_fileName); error=true; }
}
.
.
Saved me tons of time! You rock!
With CS4 (may be CS3 as well), the compilation errors are not shown in Output panel. Use fl.compilerErrors to access compilation error in these versions.
BTW, I was wondering if there was a neat way to find if I should use fl.outputPanel or fl.compilerErrors (in other words how do I find if its FlashMX/8 or CS3/4)?
[Currently I am checking if(fl.compilerErrors){}else{}]