PDA

View Full Version : break apart symbols in each frame


diddles
04-19-2006, 03:32 PM
Trying to put together a command that will go through the timeline and break apart everything in each frame but when i select the layers and run the command, it only works once then gives me "the function break apart is unavailable". I'm cobbling this code together from a couple of other commands. Any help on what I'm doing wrong would be greatly appreciated.

var curr_doc = fl.getDocumentDOM();
fl.outputPanel.clear();
curr_doc.selectNone();
var curr_tl = curr_doc.getTimeline();
var curr_lib = curr_doc.library;
var selectedframes = curr_tl.getSelectedFrames();

var startframe = selectedframes[1];
var endframe = selectedframes[2];

fl.trace(startframe);
fl.trace(endframe);

for (var i=startframe; i<endframe; i++){

fl.getDocumentDOM().selectAll();
fl.getDocumentDOM().clipCut();
fl.getDocumentDOM().clipPaste(true);
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().setFillColor('#000000');
fl.getDocumentDOM().getTimeline().setSelectedFrame s([]);



}

diddles
04-20-2006, 10:48 AM
fixed it!


for (var i=startframe; i<endframe; i++){
curr_tl.currentFrame = i;

fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();

}

androo_animator
04-20-2006, 10:24 PM
Er...your use of .getSelectedFrames() is wrong.

From the jsfl documentation:

timeline.getSelectedFrames()

Returns
An array containing 3n integers, where n is the number of selected regions. The first integer in each group is the layer index, the second integer is the start frame of the beginning of the selection, and the third integer specifies the ending frame of that selection range. The ending frame is not included in the selection.

So in your case,

var startframe = selectedframes[2];
var endframe = selectedframes[3]-1;

diddles
04-21-2006, 12:54 PM
No it all works now. i just wasn't advancing to the next frame, which i fixed by addding

curr_tl.currentFrame = i;

into my loop.


The getSelectedFrames array has three integers, therefore it's

[0],[1],[2]

androo_animator
04-21-2006, 06:17 PM
oh right, duh. need sleep

planetfall
04-08-2009, 03:00 PM
When I place the code into a .jsfl file, and try to run it from Commands/Run Command I get:

undefined
undefined

The code I'm using is:

var curr_doc = fl.getDocumentDOM();
fl.outputPanel.clear();
curr_doc.selectNone();
var curr_tl = curr_doc.getTimeline();
var curr_lib = curr_doc.library;
var selectedframes = curr_tl.getSelectedFrames();

var startframe = selectedframes[1];
var endframe = selectedframes[2];

fl.trace(startframe);
fl.trace(endframe);

for (var i=startframe; i<endframe; i++){
curr_tl.currentFrame = i;

fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();

}

I'm using CS3, why doesn't this work?

Thanks.

planetfall
04-08-2009, 03:02 PM
Okay, I selected all the frames on a layer and ran the command, now I get this:

0
91

At line 17 of file "BreakFramesApart.jsfl":
The function breakApart() is currently unavailable.