thedark_master
10-21-2011, 09:12 PM
I want to make an air app which lets the user specify a folder that contains .fla files and publish them. I know how to do this using JSFL but am stuck on how to run the jsfl file from the air app. If this is possible without jsfl and straight from air, that will work too.
Here is the jsfl script that I am using.
// options
var recursive = false;
// call
main();
function main(){
var folderURI = getFolderURIFromUser();
processFolder(folderURI);
}
function getFolderURIFromUser(){
return fl.browseForFolderURL("Select folder to process");
}
function processFolder(folderURI){
if (folderURI){
var files = FLfile.listFolder(folderURI, "files");
var file, dom;
var i = files.length;
while(i--){
file = files[i];
if (file.slice(-4).toLowerCase() == ".fla"){
fl.publishDocument(folderURI +"/"+ file);
}
}
if (recursive){
files = FLfile.listFolder(folderURI, "directories");
i = files.length;
while(i--){
processFolder(folderURI +"/"+ files[i]);
}
}
}
}
Here is the jsfl script that I am using.
// options
var recursive = false;
// call
main();
function main(){
var folderURI = getFolderURIFromUser();
processFolder(folderURI);
}
function getFolderURIFromUser(){
return fl.browseForFolderURL("Select folder to process");
}
function processFolder(folderURI){
if (folderURI){
var files = FLfile.listFolder(folderURI, "files");
var file, dom;
var i = files.length;
while(i--){
file = files[i];
if (file.slice(-4).toLowerCase() == ".fla"){
fl.publishDocument(folderURI +"/"+ file);
}
}
if (recursive){
files = FLfile.listFolder(folderURI, "directories");
i = files.length;
while(i--){
processFolder(folderURI +"/"+ files[i]);
}
}
}
}