Batch release of Flash files

Source: Internet
Author: User

I am mainly responsible for Multimedia Animation now. I don't know how to paint or design, but I can write programs. Haoku has also done. net programming.

There are thousands of Flash animations and products to be released, so the R & D director calls everyone to publish them. But I am a lazy. First, I want to see if there are batch release programs.

I searched the internet. It is written in jsfl.

After reading the code and looking for some jsfl tutorials, I decided to extend the function and write a flash plug-in. At least I had an operation interface, which was convenient, after all, this is not just for me.

This flash plug-in function is very simple. It can batch publish fla files in one or more folders, including the files in its subdirectories. Set it so that it can be released slowly, at least meet my current job.

The first is a UI.

PublishBatUI. xml

<? Xml version = "1.0" encoding = "UTF-8"?>
<Dialog buttons = "accept, cancel" title = "batch compile Flash documents">
<Vbox>
<Checkbox id = "cbSubDir" label = "include subfolders" checked = "true" accesskey = "s"/>
<! -- <Checkbox id = "cbOnlyUnpublished" label = "whether to publish only updated Flash" checked = "true" accesskey = "u"/> -->
<Label value = "Path of the Flash document: (line feed for multiple paths)"/>
<! -- <Button target = "mm" id = "btnSelPath" label = "select folder"/> -->
<Textbox id = "tbPaths" size = "100" height = "300" multiline = "true"/>
<! -- <Label value = "Release path: (the current path of the. fla file by default)"/>
<Textbox id = "pubpaths" size = "100" multiline = "false"/>
<Checkbox id = "cbIsSaveFlaPath" label = "Save As A. flat file to save the .swf file" checked = "true" accesskey = "p"/> -->
<Vbox>
</Dialog>

The file name is PublishBatUI. xml.

 

Then there is the Jsfl code.

Batch release of Fla. jsfl

// Batch release Flash files.
Var tempDoc = undefined;
If(fl.doc uments. length = 0 ){
// XmlPanel need a document, if there is none, create a temp document
TempDoc = fl. createDocument ();
}
// Create an operation 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 "){
// 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 the selection window
// Var folderURI = fl. browseForFolderURL ("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 ("Operation completed, accumulative generation" + pubNum +. ");
}
//
// Batch release Fla files
// FlaDir: the folder where fla is located;
// IsSubDir: whether to compile fla in the sub-Folder. true indicates that the sub-folder is compiled;
Function pubBatFla (flaDir, isSubDir)
{
// File 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;
// Subdirectory in the current directory
Var subDir = FLfile. listFolder (flaDir, "directories ");
For (var j = 0; j <subDir. length; j ++ ){
PubBatFla (flaDir + "/" + subDir [j], isSubDir );
}
}
// Publish the fla File
// FileURL: complete Fla file path
Function pubFla (fileURL)
{
If (fileURL. indexOf (".")>-1)
{
// Suffix of the current file
Var flExt = fileURL. substr (fileURL. lastIndexOf ("."));
// If it is a fla file, execute the release
If (flExt. toLowerCase () = ". fla "){
Var doc = fl. openDocument (fileURL );
Doc. publish ();
Doc. close ();
PubNum ++;
}
}
}

Save the file name as "batch release Fla. jsfl"

Place the two files in the following directory:

For Flash 8, place it in C: \ Documents and Settings \ Administrator \ Local Settings \ Application Data \ Macromedia \ Flash 8 \ zh_cn \ Configuration \ Commands.

For Flash CS3, place it in C: \ Documents and Settings \ Administrator \ Local Settings \ Application Data \ Adobe \ Flash CS3 \ zh_cn \ Configuration \ Commands.

 

Re-open Flash. Whether flash 8 or Flash cs3, the "batch release fla" command will be displayed in the "command" of its main menu.

Download: Batch flash.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.