Skip to main content
K7S
Inspiring
October 6, 2023
Answered

Advanced: Export Options in Layer Naming Script

  • October 6, 2023
  • 1 reply
  • 408 views

Hello, we are using a layer exporting script in 2022 animate that we found on this forum. It's very useful for managing the nomenclature and index order of sprites drawn in animate, and generally facilitates collaboration between Animate and game development very well.

However, there is a significant color quality issue when exporting because there are no Export Options when using this script. If you select Export Movie, it will give you these options. I need this Layer naming script to do this. After some research we found that it is possible and we amended the script's parameters so that it should display an export dialog that prompts you with export options now. Either the documentation that we used is out of date, or something has become obsolete. I was wondering if anyone here is familiar with the details of the Export Movie function and might see what we are missing:




 

var doc = fl.getDocumentDOM();
var lyrs = doc.getTimeline().layers;
var len = lyrs.length;
var lyr;
var originalType;
var i;
var saveDir = fl.browseForFolderURL("Choose a folder in which to save your exported SWFs:");

var layers = new Array();
var count = 0 ;

//create folder with the file name//
var exportDest = saveDir + "/" + doc.name;
FLfile.createFolder(exportDest);


if (saveDir) 
{
    fl.outputPanel.clear();
    var originalTypes = new Array();

    for (i=0; i < len; i++) 
    {
        lyr = lyrs[i];

        originalTypes[i] = lyr.layerType;
    }

    for (i=0; i < len; i++) 
    {
        lyr = lyrs[i];

        lyr.layerType = "guide";
    }

    for (i=0; i < len; i++) 
    {
        lyr = lyrs[i];

        originalType = originalTypes[i]
        if (originalType == "normal" && lyr.visible == true) 
        {
            lyr.layerType = "normal";

            doc.exportPNG(exportDest + "/" + lyr.name + ".png", false);

            fl.trace("Exported: " + lyr.name+".png");

            lyr.layerType = "guide";

            count += 1;
        }
    }

    for (i=0; i < len; i++) 
    {
        lyr = lyrs[i];

        lyr.layerType = originalTypes[i];
    }
}

 

I've tried to attach the layer naming script for your convenience but it is getting blocked.
Thank you for your time.

    This topic has been closed for replies.
    Correct answer JoãoCésar17023019

    Hi.

     

    Actually what that option means is that the script can use Animate's current settings for PNG, but you won't get a dialog for it.

     

    If you want a dialog, you'll need to create a XMLUI object/panel or create a custom extension.

     

    Here are two scripts that have a dialog:
    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/jsfl/replace_text_in_multiple_flas

    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/jsfl/set_smoothing_of_selected_items

     

    And here is a list of tags that can be used in a dialog:
    http://web.archive.org/web/20121223105042/http://photoshop-flash-coreldraw-seo-help.com/adobe-flash-help-tutorials/control-tag-summary-of-xml-to-ui-in-flash.html

     

    I hope this helps.

     

    Regards,

    JC

    1 reply

    JoãoCésar17023019
    Community Expert
    JoãoCésar17023019Community ExpertCorrect answer
    Community Expert
    October 6, 2023

    Hi.

     

    Actually what that option means is that the script can use Animate's current settings for PNG, but you won't get a dialog for it.

     

    If you want a dialog, you'll need to create a XMLUI object/panel or create a custom extension.

     

    Here are two scripts that have a dialog:
    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/jsfl/replace_text_in_multiple_flas

    https://github.com/joao-cesar/adobe/tree/master/animate%20cc/jsfl/set_smoothing_of_selected_items

     

    And here is a list of tags that can be used in a dialog:
    http://web.archive.org/web/20121223105042/http://photoshop-flash-coreldraw-seo-help.com/adobe-flash-help-tutorials/control-tag-summary-of-xml-to-ui-in-flash.html

     

    I hope this helps.

     

    Regards,

    JC

    K7S
    K7SAuthor
    Inspiring
    October 10, 2023

    Thank you very much João! Very helpful. I will give this a try and return.