Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
Results 1 to 1 of 1
-
01-21-2016, 05:45 PM #1New to the CF scene
- Join Date
- Jan 2016
- Posts
- 1
- Thanks
- 0
- Thanked 0 Times in 0 Posts
Change in JSFL script (to use subfolders not just main folder)
Hello!
Sorry if JSFL isn't actionscript, I am not a coder
I use this script
Works great except I would like it to also look in the subfolders of my selected folder.Code:/* * PNG2SWF_MULTIPLE JSFL v 1.0 * by Matus Laco, * Modified by dark13 to embedd PNGs as uncompressed files and allow smoothing * product URL: * inspired by Mr.doob * * Description: * Converts multiple png files to multiple swf files. * Input: Select folder dialog box * Output: Same folder, same filename, swf extension */ png2swf(); function png2swf() { var folderURI = fl.browseForFolderURL("Select a folder."); if (folderURI == null) { return; } var folderContents = FLfile.listFolder(folderURI); var doc = fl.createDocument(); doc.backgroundColor = '#00FF00'; var imported = 0; for(var i=0; i< folderContents.length; i++){ var pngURI = folderURI + "/" +folderContents[i]; if (pngURI.substr(pngURI.length-4) != ".png") continue; doc.importFile(pngURI); // get item var bmp_lib = doc.library.items[imported]; bmp_lib.compressionType = "lossless"; bmp_lib.allowSmoothing = true; var bmp_tl = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0]; // Scale from 1080p to 1024*768 and apply 16:9 ratio correction bmp_tl.scaleX = 0.53333 ; bmp_tl.scaleY = 0.7111 ; bmp_tl.x = 0 ; bmp_tl.y = 0 ; // set doc size doc.width = Math.floor(bmp_tl.width)+1; doc.height = Math.floor(bmp_tl.height)+1; // export var swfURI = pngURI.substr(0,pngURI.lastIndexOf(".")+1)+"swf"; doc.exportSWF(swfURI, true ); // remove previous from timeline doc.selectAll(); doc.deleteSelection(); // increase imported count imported++; } doc.close(false); alert(imported + " files created."); }
Thanks in advance! I've been googling for 2 days, but no luck.



Reply With Quote
