My main job now is to do multimedia animation, I can not paint, do not understand the design, but I will write the program. Good to stay is also done. NET programming.
We have done thousands of Flash animation, to release products, so the Director of research and development to call everyone together, but I am a lazy person, first think, there is no batch of procedures.
Online search, there is really. It's written in JSFL.
Code to understand, and find some JSFL of the tutorial looked, and decided to expand the function, write a Flash plug-in out, at least with an operating interface, when convenient, after all this stuff is not just for me.
This Flash plug-in function is very simple, can be published in bulk one or more folders under the FLA file, including its subdirectory under the, set up, let it slowly released on the line, but also practical, at least to meet my current work.
The first is a UI.
Publishbatui.xml
<?xml version="1.0" encoding="utf-8"?>
<dialog buttons="accept, cancel" title="批量编译Flash文档" >
<vbox>
<checkbox id="cbSubDir" label="是否包括子文件夹" checked="true" accesskey="s" />
<!--<checkbox id="cbOnlyUnpublished" label="是否只发布更新过的Flash" checked="true" accesskey="u" />-->
<label value="Flash文档所在路径: (多个路径请换行)" />
<!--<button target="mm" id="btnSelPath" label="选择文件夹"/>-->
<textbox id = "tbPaths" size="100" height="300" multiline="true"/>
<!-- <label value="发布后的路径:(默认为.fla文件的当前路径)" />
<textbox id = "pubpaths" size="100" multiline="false"/>
<checkbox id="cbIsSaveFlaPath" label="是否按.fla文件存放路径,保存发布后的.swf文件" checked="true" accesskey="p" />-->
<vbox>
</dialog>
The filename is publishbatui.xml.
And then there's the JSFL code.
Batch Publishing FLA.JSFL
Bulk publish Flash files.
var tempdoc=undefined;
if (fl.documents.length==0) {
Xmlpanel need a document, if there is none, create a temp document
Tempdoc=fl.createdocument ();
}
Create an Action interface
Useui = Fl.getdocumentdom (). Xmlpanel (Fl.configuri + "Commands/publishbatui.xml");
Count
var pubnum=0;
if (Tempdoc) {
Close Temp Document
Fl.closedocument (Tempdoc);
}
if (useui.dismiss== "accept") {
Whether to include subdirectories
var Issubdir=useui.cbsubdir;
Fl.trace (Issubdir);
Whether to publish only the updated
var isonlished=useui.cbonlyunpublished;
Source file path
var txtpaths=useui.tbpaths.split ("\ r \ n");
Open Selection window
var Folderuri = fl.browseforfolderurl ("Please select the folder to compile:");
Fl.trace (Folderuri)
for (var i=0; i<txtpaths.length; i++)
{
var path=txtpaths[i]= "file:///" +txtpaths[i].split (":"). Join ("|"). Split ("\"). Join ("/");
Pubbatfla (Path,issubdir);
}
Fl.trace ("The operation completes, the cumulative generation" +pubnum+ ". ");
}
//
BULK Publish FLA Files
The folder where the FLADIR:FLA resides;
Issubdir: Whether to compile subfolders under Fla,true for compilation as subfolders;
function Pubbatfla (fladir,issubdir)
{
Files in the current directory
var files= flfile.listfolder (Fladir, "files");
for (var i=0; i<files.length; i++) {
PUBFLA (fladir+ "/" +files[i]);
}
No longer compile subfolders
if (!issubdir) return;
Subdirectories under the current directory
var subdir= flfile.listfolder (Fladir, "directories");
for (Var j=0 j<subdir.length; J + +) {
PUBBATFLA (fladir+ "/" +subdir[j],issubdir);
}
}
Publish FLA File
FileURL: Full FLA file path
function Pubfla (FileURL)
{
if (Fileurl.indexof (".") >-1)
{
Current file suffix name
var flext= fileurl.substr (Fileurl.lastindexof ("."));
If it is a FLA file, the publication is executed
if (flext.tolowercase () = = ". Fla") {
var doc=fl.opendocument (FileURL);
Doc.publish ();
Doc.close ();
pubnum++;
}
}
}
File name saved as "batch publish FLA.JSFL"
Place two files in the following directory:
If it's Flash8, put it in C:\Documents and Settings\Administrator\Local Settings\Application Data\Macromedia\Flash 8\zh_cn\ Configuration\commands
If it is a Flash CS3, put it in C:\Documents and Settings\Administrator\Local Settings\Application Data\adobe\flash Cs3\zh_cn\ Configuration\commands
Re-turn on flash, whether it is flash8 or flash CS3, in its main menu command, you will see the "Batch publish FLA" command.
This article supporting source code