gpt4 book ai didi

javascript - 我们可以从命令行从 flash 导出到 createjs 吗?

转载 作者:太空宇宙 更新时间:2023-11-04 01:08:21 26 4
gpt4 key购买 nike

我正在寻找一种方法来自动执行运行 toolkit for flash for createjs 的任务从命令行。

我有很多单独的组件,我想以批处理方式导出它们。这可以吗?

最佳答案

自动化的最佳选择是使用 。以下脚本,修改自this thread提示输入目标文件夹和输出文件夹,然后自动执行打开 *.fla 文件并在执行时通过 CreateJS 发布者发布它们的过程。需要注意的是,CreateJS 面板必须已在 Flash 中打开(尽管也可能有一种方法可以做到这一点)。

还值得注意的是,您可以轻松地修改此代码以硬编码您需要的路径,或者阅读 JSFL Docs或动态加载 list 文件。如果您确实想从命令行运行它们,也可以从批处理中执行它们。

exporter.jsfl

var folderURI = fl.browseForFolderURL("Please select the folder you want to recurse");
var outputURI = fl.browseForFolderURL("Please select the output path");

var allFlas = FLfile.listFolder(folderURI + "/" + "*.fla", "files");
for(var i = 0; i < allFlas.length; i++)
{
var flaName = allFlas[i];

var doc = fl.openDocument(folderURI + "/" + flaName);
var targetName = doc.name.replace(".fla","");
var cjsDataKey = "CreateJSToolkit_data";
//var data = doc.getDataFromDocument(cjsDataKey);
var data = [
"version", "0.6",
"exportHTML", "true",
"frameBounds", "false",
"includeHiddenLayers", "false",
"soundsPath", "sounds/",
"preview", "false",
"imagesPath", "images/",
"libraryPath", "libs/",
"compactPaths", "false",
"exportSounds", "true",
"imagesNS", "images",
"exportLibs", "true",
"libNS", "lib_" + targetName.toLowerCase(),
"hostedLibs", "true",
"exportImages", "true",
"outputPath", outputURI,
"createjsNS", "createjs"
];
doc.addDataToDocument(cjsDataKey, "string", data.join("\n"));
doc.save();
doc.close(false);
// Re-open document so that Publish for CreateJS panel picks up changes.
doc = fl.openDocument(folderURI + "/" + flaName);
fl.runScript(fl.configURI + "Commands/Publish for CreateJS.jsfl");
// Insert an artificial pause here. Seems to be necessary for Toolkit publish.
alert("Complete!");
doc.close(false);
}

关于javascript - 我们可以从命令行从 flash 导出到 createjs 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20622499/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com