Skip navigation
alexandre.imbert
Currently Being Moderated

name an png sequence

Feb 12, 2013 10:04 AM

hi evry one

 

i m exporting a png sequence from a "charcater" on  the scene which has many state. ("idle", "action","jump")

 

i'd like to name a png sequence and that it takse the name of either the label or the name of the graphic clip on the scene.

is it possible ?

 
Replies
  • Currently Being Moderated
    Feb 12, 2013 11:46 AM   in reply to alexandre.imbert

    Yes. The Following script will export a png sequence accroding to the framelabels you gave your animation.

    For example if you have frame 1 labeled as "idle" and in the same timeline frame 10 labeled as "action".

    It will output: idle_0.png; idle_1.png ...idle_9.png;action_10.png......

     

    Open your fla document with the animation in the timeline window.

     

    Cretae a new Jsfl file: File>New>FlashJavascriptFile

     

    insert this code in the jsfl file:

     

    var doc = fl.getDocumentDOM();

    var lyrs = doc.getTimeline().layers;

     

    var len = lyrs.length;

    var totalframes;

    var lyr;

    var i;

    var pngName;

    var saveName;

    var curLabel;

    var tl = doc.getTimeline();

     

    var saveDir = fl.browseForFolderURL("Choose a folder in which to save your exported PNGs:");

    if (saveDir) {

     

        for (i=0; i < len; i++) {

            lyr = lyrs[i];

            totalframes = lyrs[i].frameCount;

            for (j=0;j<totalframes;j++){

                if(lyr.frames[j].name !=""){

                   curLabel = lyr.frames[j].name;

                }

                exportPng(j);

                //this advances the playhead

                tl.setSelectedFrames(j,j+1);

            }

        };

    }

     

    function exportPng(j) {

        pngName = saveDir + "/" + curLabel + "_"+j+".png";

        doc.exportPNG(pngName, true, true);

        fl.trace("Exported: " + pngName);

    }

     

    //code was inspired by this post

     

    Click on the RunScript icon (|>).

     

    Flash will ask you where to save your exported sequence.

     

    Choose a directory.

     

    Click OK.

     

    If Flash is ready you will find your files in the specified directory.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 1:06 AM   in reply to alexandre.imbert

    i'll hold you to that

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points