/ Published in: ActionScript 3
Expand |
Embed | Plain Text
// create a temporary directory var tempDir : File = File.createTempDirectory(); // create a temporary file in the temporary directory called run.jsfl var tempFile : File = tempDir.resolvePath("run.jsfl"); // write the returned string from the JSFLCreate function var fs : FileStream = new FileStream(); fs.open(tempFile, FileMode.WRITE); fs.writeUTFBytes(JSFLCreate($fileArray)); fs.close(); // open the file with the default application tempFile.openWithDefaultApplication(); function JSFLCreate ( $fileArray : Array ) : String { var urlString : String = ''; var content : String = ''; for each (var $file : File in $fileArray) { // writes the path to all the dragged in files to a string urlString += '"file://'+$file.nativePath+'",'; } // remove the trailing comma urlString = urlString.slice( 0, -1 ); // write all the paths to an array content += 'var uriArr = ['+urlString+'];'; content += 'var sl = uriArr.length;'; // use the default publish profile, this can be modified content += 'var publishProfileName = "Default";'; // create a loop which runs through all of the selected files, and publishes them. content += 'for(var i = 0; i < sl; i++){'; content += 'fl.publishDocument(uriArr[i], publishProfileName);'; content += '}'; return content; }
You need to login to post a comment.
