我发现这个脚本似乎可以满足我的需要,但是,当我尝试导出文件时,我得到“文件名:假”作为输出。任何想法?
http://cookbooks.adobe.com/post_Extract_bitmaps_and_audio_from_a_FLA_file-18144.html
我发现这个脚本似乎可以满足我的需要,但是,当我尝试导出文件时,我得到“文件名:假”作为输出。任何想法?
http://cookbooks.adobe.com/post_Extract_bitmaps_and_audio_from_a_FLA_file-18144.html
花了我一点时间,但我发现了你的问题。问题在于您的声音文件的这个小属性:soundItem.originalCompressionType
. 您可以在此处找到该问题的一些详细信息。您的代码中发生的事情是它将尝试将声音文件导出为存储在库中的类型。即filename.mp3 保存为.mp3 文件,filename.wav 保存为.wav 文件。如果soundItem.originalCompressionType
等于“RAW”,则无法将声音文件保存为 .mp3 文件,因此会输出“filename: false”。您必须将文件另存为 .wav 文件。在定义 imageFileURL 时,我稍微修改了代码来执行此操作。
// Result of attempts to export will go to the output panel,
// so clear that first fl.outputPanel.clear();
// If bitmaps/audio in the library have been selected, export only
// those. Otherwise, export all bitmaps/audio in the library.
var lib;
if (fl.getDocumentDOM().library.getSelectedItems().length > 0) {
lib = fl.getDocumentDOM().library.getSelectedItems();
} else { lib = fl.getDocumentDOM().library.items; }
// Get destination directory for files
var imageFileURLBase = fl.browseForFolderURL("Select a folder.");
var imageFileURL;
var totalItems = lib.length;
// Iterate through items and save bitmaps and
// audio files to the selected directory.
for (var i = 0; i < totalItems; i++)
{
var libItem = lib[i];
if (libItem.itemType == "bitmap" || libItem.itemType == "sound")
{
// Check the audio files original Compression Type if "RAW" export only as a .wav file
// Any other compression type then export as the libItem's name defines.
if(libItem.itemType == "sound" && libItem.originalCompressionType == "RAW")
{
wavName = libItem.name.split('.')[0]+'.wav';
imageFileURL = imageFileURLBase + "/" + wavName;
} else {
imageFileURL = imageFileURLBase + "/" + libItem.name;
}
var success = libItem.exportToFile(imageFileURL);
fl.trace(imageFileURL + ": " + success);
}
}