|
如何从.Fla文件 中导出声音# [size=19.8351px]如果您在.fla文件中有 Flash 游戏音效,则无法从 GUI 导出它们(至少在 Adobe Animate CC 2017 中不能),因为缺少用于此目的的菜单选项。但是还有另一种解决方案——一个专门的脚本可以做到这一点: [size=19.8351px] function normalizeFilename(name) { // Converts a camelCase name to snake_case name return name.replace(/([A-Z])/g, '_$1').replace(/^_/, '').toLowerCase();}function displayPath(path) { // Makes the file path more readable return unescape(path).replace('file:///', '').replace('|', ':');}fl.outputPanel.clear();if (fl.getDocumentDOM().library.getSelectedItems().length > 0) // Get only selected items var library = fl.getDocumentDOM().library.getSelectedItems();else // Get all items var library = fl.getDocumentDOM().library.items;// Ask user for the export destination directoryvar root = fl.browseForFolderURL('Select a folder.');var errors = 0;for (var i = 0; i < library.length; i++) { var item = library[i]; if (item.itemType !== 'sound') continue; var path = root + '/'; if (item.originalCompressionType === 'RAW') path += normalizeFilename(item.name.split('.')[0]) + '.wav'; else path += normalizeFilename(item.name); var success = item.exportToFile(path); if (!success) errors += 1; fl.trace(displayPath(path) + ': ' + (success ? 'OK' : 'Error'));}fl.trace(errors + ' error(s)'); [size=0.9em] 复制
[size=19.8351px]如何使用脚本导出声音文件:
- 将上面的代码另存为.jsfl文件在您的计算机上;
- 使用 Adobe Animate打开一个.fla文件;
- 从顶部菜单中选择“命令”→“运行命令”,然后在打开的对话框中选择脚本;
- 现在弹出另一个对话框文件,用于选择导出目标目录。
[size=19.8351px]并做了!您现在应该在指定目录中有 WAV 文件。剩下要做的就是将它们转换为例如 MP3、OGG 或 AAC。
|