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! :)
Comments (13)
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") {...} ?
Posted by: ripcurlx at August 20, 2004 02:00 AMURL:
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
Posted by: ripcurlx at August 20, 2004 02:10 AMa
ripcurlx
URL:
good catch - fixed and uploaded again.
Cheers.
Posted by: Grant Skinner at August 20, 2004 03:02 PMURL: http://gskinner.com/
you tha man!
Posted by: Gianni at August 20, 2004 10:50 PMbut your documentation link above is 404
URL: http://www.lifthere.com
Whoops... fixed the link.
Posted by: Grant Skinner at August 21, 2004 01:37 AMURL: http://gskinner.com/
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
Posted by: ripcurlx at August 24, 2004 02:32 AMURL:
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
Posted by: Jonny at September 7, 2005 05:41 AMURL:
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.
Posted by: kurt Melander at April 19, 2006 10:54 AMURL:
Kurt: This extension requires the 7.2 update found at http://www.macromedia.com/support/flash/downloads.html
Posted by: Lanny at April 19, 2006 11:58 AMURL: http://gskinner.com
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!
Posted by: Chris at February 20, 2007 11:31 AMURL:
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".
Posted by: Arvind at March 21, 2008 10:33 AMAnd 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.
URL:
The publish profile error can be resolved by simply changing row[1] to row[2] in the call to compile function.
Posted by: Arvind at April 2, 2008 09:11 PMrow[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; }
}
.
.
URL:
Saved me tons of time! You rock!
Posted by: Marcus *Kjeldsen at October 21, 2008 06:34 AMURL: