Copy link to clipboard
Copied
I'm sure, that it is a bag, but if not, help me.
I'm trying to get sourceText keyValues
My code works perfectly, untill i move my text layer in timeline.
When i do, (when layer's startTime not at the start of comp), the keyValues is offseting!
For example, here is the text in keys (the text = frames) "0, 10, 20, 30"
If I shift layer by 10 frames forward, the result be "10, 20, 30, 30"
If shift 10 frames backward, - "0, 0, 10, 20"
How to fix it? Without offseting the layer to get the right value of course.
try{
var comp = app.project.activeItem;
var sourceTextProp = comp.layer(1).property("ADBE Text Properties").property("ADBE Text Document");
var textContent = "";
if (sourceTextProp.numKeys > 0) {
for (var k = 1; k <= sourceTextProp.numKeys; k++) {
var textDocument = sourceTextProp.keyValue(k);
textContent += textDocument.text + " ";
}
alert(textContent);
}
} catch(err) {alert(err.toString + "\n" + err.line)}
Yes, it's a bag.
try this:
try{
var comp = app.project.activeItem;
var sourceTextProp = comp.layer(1).property("ADBE Text Properties").property("ADBE Text Document");
// store the startTime;
var startTime = comp.layer(1).startTime;
// set the startTime to 0;
comp.layer(1).startTime = 0;
var textContent = "";
if (sourceTextProp.numKeys > 0) {
for (var k = 1; k <= sourceTextProp.numKeys; k++) {
var textDocument = sourceTextProp.keyValue(k);
...
Copy link to clipboard
Copied
Yes, it's a bag.
try this:
try{
var comp = app.project.activeItem;
var sourceTextProp = comp.layer(1).property("ADBE Text Properties").property("ADBE Text Document");
// store the startTime;
var startTime = comp.layer(1).startTime;
// set the startTime to 0;
comp.layer(1).startTime = 0;
var textContent = "";
if (sourceTextProp.numKeys > 0) {
for (var k = 1; k <= sourceTextProp.numKeys; k++) {
var textDocument = sourceTextProp.keyValue(k);
textContent += textDocument.text + " ";
}
// restore the startTime
comp.layer(1).startTime = startTime;
alert(textContent);
}
}
catch(err) {
alert(err.toString + "\n" + err.line)}
Find more inspiration, events, and resources on the new Adobe Community
Explore Now