PDA

View Full Version : Select frames not in sequence


prime0196
10-11-2005, 05:56 PM
I have a simple script that selects a series of concurrent frames(0-10) and converts them into keyframes. How would I modify this script so that i could select frames 0, 5, 10 without writing three separate lines of code. I am new to JSFL and programming in general. Here is my script



var dom=fl.getDocumentDOM()
var timeline=dom.getTimeline()

timeline.setSelectedFrames(0,10,true);
timeline.convertToKeyframes(0,10);

Sunny13
10-12-2005, 11:49 AM
use a loop for this

prime0196
10-15-2005, 07:45 PM
Ok, tried writing a loop, but I get an error saying the second argument is invalid in line 12. Here is my loop:


var iFrames = "0;5;10;15;20;25";
var oArray = iFrames.split(";");

var dom=fl.getDocumentDOM()
var timeline=dom.getTimeline()

var i = 0;
var iStart = 0

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

timeline.setSelectedFrames(iStart,oArray[i],true);

timeline.convertToKeyframes(iStart,oArray[i]);

iStart = oArray[i];

}

jjbilly
10-16-2005, 07:23 PM
Your loop here is going through strings, not really numbers (because you get them from a string).

Try instead looping from i =0 to i =5, and then multiplying by 5 each time:

timeline.setSelectedFrames(i*5,(i+1)*5,true);