FORUMS: list search recent posts

Flash Script Converts Layers to Movie Clip

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alan Wasem
Flash Script Converts Layers to Movie Clip
on May 20, 2015 at 10:37:21 pm

Hi, j/w if anyone could help me figure this out. I am trying to get all the layers I brought in from AI CC to Flash CC converted to movie clip symbols and name them with the layer name. The author of the script said it selects everything on the flash layer then makes a movie clip with the same name as the layer. Here is a link to where I found it https://kogumine.wordpress.com/2011/01/06/flash-command-convert-layers-to-m...

When I open the script from the commands dropdown in Flash via "run command..." I get an error "illegal character" 8849_screenshot2015052015.28.53.png.zip

I got it to work once by pasting this code into the action window, but then I could not repeat it. Any help would be much appreciated Thanks!

var dom = fl.getDocumentDOM();
var timeline = dom.getTimeline();
var library = dom.library;
var trace = fl.trace;

trace("*** Convert layers to movieclips ***");

var layers = timeline.layers;

for(var i = 0;i<layers.length;i++){
dom.selectNone();
var layerName = layers[i].name;
trace(layerName);
var movieClipName = layerName.split(" ").join("");
// select the layer
timeline.setSelectedLayers(i);
// select everything on the first frame
for (var n in layers[i].frames[0].elements) {
var e = layers[i].frames[0].elements[n];
e.selected = true;
}
// convert it to a symbol
dom.convertToSymbol("movie clip", movieClipName, "top left");

// option: add a class & linkage id

library.selectItem(movieClipName, true, true);
library.setItemProperty('linkageExportForAS', true);
library.setItemProperty('linkageExportForRS', false);
library.setItemProperty('linkageExportInFirstFrame', true);
library.setItemProperty('linkageClassName', movieClipName);
// movieClipName must be unique (layer names must be unique too!)
library.setItemProperty('linkageBaseClass', "TheClassName");

// end option
}


Return to posts index

Alan Wasem
Re: Flash Script Converts Layers to Movie Clip
on May 20, 2015 at 11:23:56 pm

A developer friend just wrote back and helped out. I just had to change the format in text edit from rich text to plain text.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]