简体   繁体   English

一次将许多 .fla 文件转换为 .swf 或 .mov 文件

[英]Convert many .fla files to .swf or .mov files at once

I have a folder with many FLA files (files.fla) in it.我有一个包含许多 FLA 文件 (files.fla) 的文件夹。

I was wondering if there is a way to convert all those.fla files to.swf or.mov files at once (not opening each fla file in Adobe Animate and then export them to swf).我想知道是否有一种方法可以一次将所有这些 .fla 文件转换为 .swf 或 .mov 文件(而不是在 Adobe Animate 中打开每个 fla 文件,然后将它们导出为 swf)。

I'm also wondering if it is possible to achieve this using a Python script or maybe a JavaScript code being executed externally to Adobe Animate.我还想知道是否可以使用 Python 脚本或在 Adobe Animate 外部执行的 JavaScript 代码来实现这一点。

If someone has any idea or any links it would be helpful.如果有人有任何想法或任何链接,那将很有帮助。

I have found a way to do it not externally.我找到了一种不在外部进行的方法。

I post this in hope that it will help someone else struggling to find out how to do it within the software itself (Adobe Animate).我发布这篇文章是希望它能帮助其他人努力找出如何在软件本身(Adobe Animate)中做到这一点。

Here's a snippest of the code doing that (that is not optimized).这是执行此操作的代码片段(未优化)。

By the way it is really inspired by an answer on StackOverFlow (I do not remember the link).顺便说一句,它真的受到 StackOverFlow 上的答案的启发(我不记得链接了)。

var swfFolder = 'Path/to/SWF/Files'​
var flaFolder = fl.browseForFolderURL('Path/to/FLA/Files');​
var folderContents = FLfile.listFolder(flaFolder);

for(i = 0; i < folderContents.length; i++){​
​
   file = folderContents[i];​
   swfFilename = file.replace(".fla", ".swf");​
   file = 'Path/to/FLA/Files' + file;​
   fl.openDocument(file);​
   fl.getDocumentDOM().exportSWF(swfFolder + "/" + swfFilename, true);​
   fl.closeDocument(file);​

}​

It has some problems.它有一些问题。 The first time you execute this script, it will open a sort of browser file in order to choose the directory in which FLA files are located.第一次执行此脚本时,它将打开一种浏览器文件,以便选择 FLA 文件所在的目录。 and then pressing on ok for each file.然后为每个文件按ok

But if you want just a script that does the export on a one file only, the code above will be helpfull:但是,如果您只想要一个仅在一个文件上执行导出的脚本,那么上面的代码将很有帮助:

var swfFolder = 'Path/to/SWF/Files';
var swfFilename = "exportedFile.swf";
fl.getDocumentDOM().exportSWF(swfFolder + "/" + swfFilename, true);​

In order to answer fully to my question (executing externally a code that exports FLA files to SWF files), we have to found out how to execute this script from a command line (cmd in Windows).为了完全回答我的问题(在外部执行将 FLA 文件导出为 SWF 文件的代码),我们必须了解如何从命令行(Windows 中的 cmd)执行此脚本。 Then to extend it to a folder of many files.fla, we can make a little Python code that calls the script on each file of the FLA directory.然后将它扩展到一个包含许多files.fla的文件夹,我们可以编写一个小Python代码,在FLA目录的每个文件上调用脚本。

However, I didn't find how to achieve that.但是,我没有找到如何实现这一点。 So if someone has the answer to that, please let us know.因此,如果有人对此有答案,请告诉我们。

EDIT编辑

To call a JSFL script on a FLA file, use:要在 FLA 文件上调用 JSFL 脚本,请使用:

Path\To\Animate.exe file.fla Path\To\file.jsfl

( Link to the reference ) 链接到参考

When I had to make a Python script for that purpose, this whole command didn't work for me, I had to first open Adobe Animate with my fla file, wait some seconds (using time.sleep()) and then call the command当我不得不为此目的制作 Python 脚本时,整个命令对我不起作用,我必须先用我的 fla 文件打开Adobe Animate ,等待几秒钟(使用 time.sleep())然后调用命令

Path\To\Animate.exe Path\To\file.jsfl

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM