I want to add text to a textfield, and specify the font of that text.
.defaultTextFormat is ALMOST what I want, but not quite. To demonstrate, try this out:
var output:TextField = new TextField();
output.height=200;
output.width=500;
addChild(output);
var outputFormat:TextFormat = new TextFormat();
for (var i:int=0;i<20;i++) {
if (Math.random()<0.3)
output.appendText("
");
outputFormat.size=Math.round(Math.random()*30);
output.defaultTextFormat=outputFormat;
output.appendText(i+'line ');
}
If you run this, you’ll find that the the font size only changes between lines. Each line is a single size, when I want to be able to have multiple sizes on the same line.
I am also open to using a textArea instead of a textField, if that will work better.