# createTextField & Font Style

**URL:** <https://forum.kirupa.com/t/createtextfield-font-style/59331>\
**Category:** flash\
**Created:** [July 30, 2004, 10:43am UTC](https://forum.kirupa.com/t/createtextfield-font-style/59331 "2004-07-30T10:43:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_4\_Cologne](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Alex\_4\_Cologne](https://forum.kirupa.com/u/Alex_4_Cologne)\
**Post date:** [July 30, 2004, 10:43am UTC](https://forum.kirupa.com/t/createtextfield-font-style/59331/1 "2004-07-30T10:43:22Z")

</div>

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

this does not work ☹

```auto

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 30, 2004, 3:41pm UTC](https://forum.kirupa.com/t/createtextfield-font-style/59331/2 "2004-07-30T15:41:29Z")

</div>

You have to use the textformat class:

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