The Snepo Blahg

JSFL By Arse

Having recently found myself in a situation where I was required to double frame a massive amount of animation I figured I wanted to preserve my click finger and F5 key.

JSFL to the rescue:

var additionalframes = 1;
function addFrames(item){
    var frms = item.frameCount;
    for(var j=frms;j>0;j--) 
        item.insertFrames(additionalframes, true, j-1);
}
var dom = fl.getDocumentDOM();
addFrames(dom.timelines[0]);
for(var i=0;i<dom.library.items.length;i++) { 
    addFrames(dom.library.items[i].timeline);
}

The script is run as a command and will recursively traverse all time lines (including anything in your library) and add additional frames as specified by the additionalframes variable.

sample files (.zip 64kb) Another handy JSFL script for those times when you need to change font usage across an entire fla. This command is particularly handy when dealing with missing fonts that need to be updated or change at a later date.

var dom = fl.getDocumentDOM();
var font_select = "Arial";
var font_replace = "Verdana" 
chageFonts = function(timeline) {
  for(var layer in timeline.layers){
    for(var frame in timeline.layers[layer].frames){
      for(var element in timeline.layers[layer].frames[frame].elements) {
        var item = timeline.layers[layer].frames[frame].elements[element];
        for(var txt in item.textRuns) {
          var font = item.textRuns[txt].textAttrs.face;
          if(font == font_select)  
            item.textRuns[txt].textAttrs.face = font_replace;
        }
      }
    }
  }
}
for(var i=0;i<dom.library.items.length;i++) {
    chageFonts(dom.library.items[i].timeline)
}
chageFonts(dom.getTimeline());

The script is run as a command and will recursively traverse all time lines (including anything in your library). It will update font usage at a character level thus preserving textfields with mixed font usage.

view/make comments (0)

What’s This?

This is the blagh of the Snepo guys—Arse, Ben, and Scott. Lots o’ fun is to be had. We promise.

Snepo is a small software company located in Surry Hills in Sydney, Australia. We like to make games and primarily concern ourselves with interesting projects and doing cool shit. We can also toast sandwiches with our minds.