# Adding formatted text to a textfield?

**URL:** <https://forum.kirupa.com/t/adding-formatted-text-to-a-textfield/269535>\
**Category:** flash\
**Created:** [August 28, 2008, 5:28pm UTC](https://forum.kirupa.com/t/adding-formatted-text-to-a-textfield/269535 "2008-08-28T17:28:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rrh](https://avatars.discourse-cdn.com/v4/letter/r/67e7ee/32.png) [@rrh](https://forum.kirupa.com/u/rrh)\
**Post date:** [August 28, 2008, 5:28pm UTC](https://forum.kirupa.com/t/adding-formatted-text-to-a-textfield/269535/1 "2008-08-28T17:28:45Z")

</div>

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:

```auto
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.
