'TextDocument' code not working in AE 26
Hi,
I've got a *.mogrt template which was using the following block of code:
// --- Source: DOG MASTER ---
var M = comp("DOG MASTER");
var srcDoc = M.layer(13).text.sourceText; // TextDocument (safe)
var size = M.layer(1).effect("Size")("Slider"); // numeric
// Prefer string if available; otherwise pass the TextDocument directly.
var srcText = (srcDoc && srcDoc.text !== undefined) ? srcDoc.text : srcDoc;
// --- Apply on THIS layer using the modern style API ---
try {
var st = text.sourceText.style;
// Make sure it will render (some styles can have fill disabled)
st.applyFill = true;
// Set true font size and then apply content
st.setFontSize(size).setText(srcText);
} catch (err) {
// Fallback for older AE / legacy engine: build a TextDocument manually
var td = new TextDocument( (srcDoc && srcDoc.text !== undefined) ? srcDoc.text : (""+srcDoc) );
// carry over some sane defaults from current value
var cur = value;
td.font = cur.font;
td.applyFill = true;
td.fillColor = cur.fillColor;
td.justification = cur.justification;
td.tracking = cur.tracking;
td.leading = cur.leading;
td.autoLeading = cur.autoLeading;
td.fontSize = size;
td;
}
It's a little bit unwieldy, but it worked... until version 26 which has now completley broken it.
I'm getting the following error on line 6
"Error: text and textAttime() can only be used with dropdown menu properties"
Does anyone have any idea why this could be happening, and why it previously worked?
