# createTextField & Font Style

**URL:** <https://forum.kirupa.com/t/createtextfield-font-style/117791>\
**Category:** Uncategorized\
**Created:** [July 30, 2004, 10:43am UTC](https://forum.kirupa.com/t/createtextfield-font-style/117791 "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/117791/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:** ![Jerryscript](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jerryscript/32/451_2.png) [@Jerryscript](https://forum.kirupa.com/u/Jerryscript)\
**Post date:** [July 30, 2004, 3:41pm UTC](https://forum.kirupa.com/t/createtextfield-font-style/117791/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.
