Copy link to clipboard
Copied
Hi,
I often have the case that when i finished banner production i would like to break apart all fonts in a document at once. Now I have to type and select each text object and make Command + B (MAc) twice for each. That's quiet time consuming. Does anyone have an idea how I could speed up this process?
Thanx for ideas.
well, breakApart() is quirky. you need to unlock layers and select the layer/frame with text and do it carefully.
here's how to do it:
var tl = fl.getDocumentDOM().getTimeline();
breakApartF();
breakApartF();
lockLayersF(false);
function breakApartF() {
for (var layerNum = 0; layerNum < tl.layerCount; layerNum++) {
for (var frameNum = 0; frameNum < tl.layers[layerNum].frameCount; frameNum++) {
var textA = [];
for (var elementNum = tl.layers[layerNum].frames[frameNum].elements.length - 1; elementNum >= 0;
...Copy link to clipboard
Copied
you can use jsfl.
var tl = fl.getDocumentDOM().getTimeline()
for (var layerNum = 0; layerNum < tl.layerCount; layerNum++) {
for (var frameNum = 0; frameNum < tl.layers[layerNum].frameCount; frameNum++) {
for (var elementNum = 0; elementNum < tl.layers[layerNum].frames[frameNum].elements.length; elementNum++) {
var element = tl.layers[layerNum].frames[frameNum].elements[elementNum];
if(element.elementType=='text'){
fl.getDocumentDOM().selection = [element];
fl.getDocumentDOM().breakApart();
fl.getDocumentDOM().breakApart();
}
}
}
}
Copy link to clipboard
Copied
that first breakApart() is going to increase the number of text items so you'll need to edit that code.
Copy link to clipboard
Copied
well, breakApart() is quirky. you need to unlock layers and select the layer/frame with text and do it carefully.
here's how to do it:
var tl = fl.getDocumentDOM().getTimeline();
breakApartF();
breakApartF();
lockLayersF(false);
function breakApartF() {
for (var layerNum = 0; layerNum < tl.layerCount; layerNum++) {
for (var frameNum = 0; frameNum < tl.layers[layerNum].frameCount; frameNum++) {
var textA = [];
for (var elementNum = tl.layers[layerNum].frames[frameNum].elements.length - 1; elementNum >= 0; elementNum--) {
var element = tl.layers[layerNum].frames[frameNum].elements[elementNum];
if (element.elementType == 'text') {
textA.push(element);
}
}
if(textA.length>0){
tl.currentLayer = layerNum;
tl.currentFrame = frameNum;
fl.getDocumentDOM().selection = textA;
fl.getDocumentDOM().breakApart();
}
}
}
}
function lockLayersF(b) {
for (var i = 0; i < tl.layerCount; i++) {
tl.layers.locked = b;
}
}
Copy link to clipboard
Copied
Hey now kglad, I'm sure kglad knows what he's doing here.
Copy link to clipboard
Copied
i wouldn't be so sure...
Copy link to clipboard
Copied
Hi kglad,
Thank you for your help. I have two questions regarding this:
1 - Were do you put the code? Is it a sort of script to set up and run on layers?
2 - If i Have to "unlock every layer and select the select carefully" than it's the same work as if I use Command+B right? What is the advantage of this script then?
Thanx a lot
Copy link to clipboard
Copied
you don't have to unlock anything. the code handles that.
you copy and paste into a jsfl file, you open your fla (with the text)>click commands>run command>and navigate to that jsfl file.
use a copies of your first few flas to make sure it works the way you want.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now