PDA

View Full Version : JSFL: Convert layer to movieclip


Ultim-o
06-14-2008, 03:40 PM
Hi There,

Is it possible to convert layers to movieclips? I have about 1200 layers, on each layer 1 group. I want them converted to movieclips.

Is something like this possible?

Thanks in advance,

Tim.

jslice390
06-16-2008, 06:16 PM
This is definitely possible. My code isn't complete but hopefully it would give you an idea for what you could do.


var doc = fl.getDocumentDOM();
var tl = doc.getTimeline();
var library = doc.library
var mc_tl;

for (var i = 0; i < tl.layers.length; i++){
tl.setSelectedLayers(i);
tl.cutFrames();
library.addNewItem("movie clip", "mc" + i);
library.editItem("mc" + i);
mc_tl = fl.getDocumentDOM().getTimeline();
mc_tl.setSelectedLayers(0);
mc_tl.pasteFrames();
doc.exitEditMode();
library.addItemToDocument({x:0, y:0}, "mc" + i);
}


Basically what this does it goes through each layer, cuts the frames, creates a new movie clip in the library, pastes the frames in the new symbol, exits the symbol and goes on to the next layer.

Ultim-o
06-18-2008, 02:11 PM
Great, thanks! This will definitely help me going on, thanks a lot