2012-07-09 115 views
0

在Flash 5.5中,您可以創建Flash項目,以便在生產時間共享閃存文件庫。它還允許您將所有文件一起發佈。我們如何爲Flash項目設置一般發佈設置?

我想要當我發佈所有的閃存文件,輸出swf文件保存到一個特定的文件夾。 我無法找到一種方法來實現這一功能,所以如果您有200個文件,則需要轉到每個fla文檔並更改其發佈設置。這有點毀了所有的項目的有用性...

可能會使用jsfl做到這一點。不過,寧願以其他方式做,所以我們的藝術家團隊可以像以前一樣繼續工作。

非常感謝您的時間和事先的幫助。

回答

0

您的問題的答案是肯定的JSFL可以爲您做到這一點。我會給你一個例子,並嘗試在jsfl代碼中發表評論,以便我能夠解釋發生了什麼。隨意問任何澄清問題。

因此,讓我們假設您的計算機上有一個包含許多其他文件夾的文件夾,這些文件夾都包含FLA文件。該代碼將遍歷該主要包含文件夾中的所有文件夾,我們將其稱爲「allFLAs」,然後將其輸出到名爲「allSWFs」的文件夾。下面的代碼將保留所有SWF中allFLA的原始文件夾。所以如果一個FLA文件在所有的FLAs/group1/file1.fla中,那麼在所有的SWF文件中都會有所有的SWFs/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()