1 Reply Latest reply on Dec 2, 2012 10:02 AM by Aemon Cannon

    Publish CreateJS via JSFL

    Aemon Cannon

      Is it possible to invoke the Publish function of the Flash Professional ToolKit for CreateJS via jsfl?

      I hava _many_ .fla assets that I need to publish in bulk. Would also be nice to be able to configure the destination directory via jsfl.



      Aemon Cannon

        • 1. Re: Publish CreateJS via JSFL
          Aemon Cannon Level 1

          For posterity, here's what I came up with. Seems to work pretty well:


          var flaBase = base + "media/flash/assets/accessories";

          var allFlas = FLfile.listFolder(flaBase + "/*.fla", "files");

          for(var i = 0; i < allFlas.length; i++){

                    var flaName = allFlas[i];

                    var doc = fl.openDocument(flaBase + "/" + flaName);

                    var targetName = doc.name.replace(".fla","");

                    var cjsDataKey = "CreateJSToolkit_data";

                    //var data = doc.getDataFromDocument(cjsDataKey);

                    var data = [

                              "version", "0.1",

                              "exportHTML", "false",

                              "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", "file:///outputpath/",

                              "createjsNS", "createjs"


                    doc.addDataToDocument(cjsDataKey, "string", data.join("\n"));



                    // Re-open document so that Publish for CreateJS panel picks up changes.

                    doc = fl.openDocument(flaBase + "/" + flaName);

                    fl.runScript(fl.configURI + "Commands/Publish for CreateJS.jsfl");

                    // Insert an artificial pause here. Seems to be necessary for Toolkit publish.