我们如何为Flash项目设置常规发布设置?

时间:2012-07-09 11:00:04

标签: flash flash-cs5.5

在Flash 5.5中,您可以创建Flash项目,以便在生产时共享Flash文件库。它还允许您将所有文件一起发布。

我想在发布所有flash fla文件时,输出swf文件保存到特定文件夹。 我无法找到一种方法使其自动化,因此如果您有200个文件,则需要转到每个fla文档并更改其发布设置。哪种方式破坏了所有项目的实用性......

可能可以使用jsfl来完成。但更喜欢以其他方式做到这一点,所以我的艺术家团队可以像以前一样继续工作。

非常感谢您的时间和提前帮助。

1 个答案:

答案 0 :(得分:0)

你的问题的答案是肯定的,JSFL可以为你做这件事。我将举一个例子,尝试在jsfl代码中发表评论,尽我所能来解释发生了什么。随意提出任何澄清问题。

因此,假设您的计算机上有一个文件夹,其中包含许多其他文件夹,这些文件夹都包含FLA文件。此代码将遍历该main包含文件夹中的所有文件夹,让我们将其称为“allFLAs”,然后将它们输出到名为“allSWFs”的文件夹中。下面的代码将保留allWWF中所有FLAs的原始文件夹。因此,如果FLA文件位于allFLAs / group1 / file1.fla,那么在allSWF中将包含allSWFs / group1 / file1.swf。如果您具有相同名称的文件,则它们将不会相互覆盖。您可以从exportSWF行中删除+ dirList [n],它会将所有SWF放入主allSWFs文件夹中。

此代码不会更改其运行的任何文件的发布设置,并在完成后关闭Flash IDE。

// Main folder that holds the folders containing all the FLA files.
var folder = 'file:///C:/path/to/main/folder/allFLAs';

if (!null) {
    // Create an array of all the folders that are contained in our main folder.
    var dirList = FLfile.listFolder(folder, 'directories');
    // Loop through each item in the array to find each FLA file.
    for (var n = 0; n<dirList.length; ++n) {
        // Create an array of all FLA files in the directory list array.
        var list = FLfile.listFolder(folder+'/'+ dirList[n] + '/*.fla', 'files');
        fl.outputPanel.trace('file:///C:/path/to/output/folder/allSWFs/'+ dirList[n]);
        // Create containing folder for this file based on the name of the folder in the directory list array, in the new output folder.
        FLfile.createFolder('file:///C:/path/to/output/folder/allSWFs/'+ dirList[n]);
        var flaName;
        var swfName;
        for (var i = 0; i<list.length; ++i) {
            flaName = list[i];
            swfName = list[i].split('.')[0]+'.swf';
            fl.outputPanel.trace(flaName+' exported as '+swfName);
            // open the document, publish to SWF, and close without saving.
            fl.openDocument(folder+'/'+ dirList[n] +'/'+flaName);
            fl.getDocumentDOM().exportSWF('file:///C:/path/to/output/folder/allSWFs/'+ dirList[n] + '/'+swfName, true);
            fl.closeDocument(fl.getDocumentDOM(), false);
        }
    }
}
fl.quit()