JSFL: List Frame Labels

Finishing up a project which consists of a series of Flash presentation SWF’s. The controller that plays them uses an XML file to determine what SWF’s to play as well as what their frame labels are. Since I have to document this manually, and some of the SWF’s have timelines between 7 to 10 thousand frames long, scrolling to find them is tough. Thus, I made this script to list them for me. Assumes you have a layer named “labels”.

show frame labels – JSFL

function init()
{
        var doc = fl.getDocumentDOM();
        var tim = doc.getTimeline();
        var l_array = tim.layers;
        var i = l_array.length;
        while(i--){
                var lay = l_array[i];
                if(lay.name.toLowerCase() == "labels"){
                        var f_array = lay.frames;
                        var s = "";
                        var last = "";
                        for(var f=0; fif(f_array[f].labelType == "name"){
                                        if(f_array[f].name != last){
                                                s += "frame: " + f_array[f].name + ", number: " + (f + 1) + "\n";
                                                last = f_array[f].name;
                                        }
                                }
                        }
                        fl.trace("*** Frame Labels ***");
                        fl.trace(s);
                        return;
                }
        }
}

init();

6 Replies to “JSFL: List Frame Labels”

  1. At least with Director at runtime, you can get the current frame’s label… using it’s timeline, or a Flash sprite’s!

  2. Funny you should mention it; I tried that very extension since I have it installed, and even after 2 script errors, it wouldn’t show. That’s the whole reason I wrote the script cause his window didn’t work with such long SWF’s.

  3. it didn’t work…I put the code at the first frame and a stop(); it gives me bunch of error code..

  4. That is JSFL, not ActionScript. Therefore, it must be in an external file (usually), with a jsfl extension. You can then run it in Flash MX 2004 via Commands > Run Command… find the file, select it, and hit ok.

Comments are closed.