createTextField & Font Style

How can I change Font Style etc of TextFields that were created by Action Script?

this does not work :frowning:


container.createTextField("txt" + i, 50 + i, 58 + (i - 1) * 109, 150, 80, 40)
container["txt" + i].underline = true

You have to use the textformat class:

container.createTextField("txt" + i, 50 + i, 58 + (i - 1) * 109, 150, 80, 40)
thisFormat=container["txt'+i"].getTextFormat();
thisFormat.underline = true;
container["txt" + i].setTextFormat(thisFormat);

You don’t really need the second line, but it will preserve all other text formatting that is already present.