我们可以从命令行从flash导出到createjs吗? [英] Can we export from flash to createjs from the command line?

查看:237
本文介绍了我们可以从命令行从flash导出到createjs吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种方法来自动执行运行工具包的任务对于来自命令行的flash for createjs

I am looking for a way to automate the task of running the toolkit for flash for createjs from the command line.

我有很多单独的组件,我想在批处理过程中导出它们。可以这样做吗?

I have a lot of individual components and I would like to export them in a batch process. Can this be done?

推荐答案

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

Your best bet for automation would be to use jsfl. The following script, modified from this thread prompts for a target folder and output folder, then automates the process of opening *.fla files and publishing them via the CreateJS publisher when executed. One caveat is that the CreateJS panel has to be open in Flash already (though there may be a way to do this too).

值得注意的是,你可以同样可以轻松修改此代码以硬编码您需要的路径,或者阅读 JSFL Docs 或动态加载清单文件。如果你真的想从命令行运行它,也可以批量执行它们。

It is also worth noting that you can just as easily modify this code to either hardcode the path's you need, or read up on the JSFL Docs or dynamically load a manifest file. You can execute them from a batch as well if you really want to run it from a command line.

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);
}

这篇关于我们可以从命令行从flash导出到createjs吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆