I'm testing a couple of things in preparation for some localization changes. Right now I'm trying to change some default text formatting at run-time, and running into a problem: the text formatting reverts when I click into a textInput or textArea.
So I start off changing a textField's textFormat and defaultTextFormat like so:
import flash.text.TextFormat;
var textFormat:TextFormat;
textFormat = new TextFormat();
textFormat.font = "Palatino Linotype";
textFormat.size = 12;
textFormat.color = "0xFFFFFF";
function setFormatting():void
{
characterNotes.textInput.textField.setTextFormat(textFormat);
characterNotes.textInput.textField.defaultTextFormat = textFormat;
}
setFormatting();
characterNotes.textInput.text = "Test test test";
And if I don't click on anything, then the formatting is correct (i.e., Palatino, 12 point, white). But if I click on the textField in my characterNotes movie clip, it goes back to its original default text format (set in Adobe Animate's editor's component properties window). If I click in and out of the textField a couple times, it will keep the intended text format (set in code). Any idea why it reverts at all? How can I stop it from reverting?
Also, I already tried adding an addEventListener("focusIn", setFormatting)
to the textField, but the format reverts anyway.