# CreateTextField and changing text color

**URL:** https://forum.kirupa.com/t/createtextfield-and-changing-text-color/222487
**Category:** flash
**Created:** [April 13, 2007, 8:48pm UTC](https://forum.kirupa.com/t/createtextfield-and-changing-text-color/222487 "2007-04-13T20:48:57Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nymyth](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@nymyth](https://forum.kirupa.com/u/nymyth)
#### Post date: [April 13, 2007, 8:48pm UTC](https://forum.kirupa.com/t/createtextfield-and-changing-text-color/222487/1 "2007-04-13T20:48:57Z")

</div>

What im trying to do is: have a dynamically created text field change color when i roll over a movieclip.

This is what i have:  
a movie clip with this code:

```auto
this.createTextField("header", 99, 10, 10, 100, 300);
header.autoSize = true;
header.embedFonts = true;
var my_fmt:TextFormat = new TextFormat();
my_fmt.size = 50;
my_fmt.color = 0x9A9A9A;
my_fmt.font = "Impact";
header.setNewTextFormat(my_fmt);

```

Now 2 instances of this moveiclip are placed inside another movieclip. Each one showing a different text. (these instance are to act like buttons)

INSTANCE 1:

```auto
onClipEvent (enterFrame)
{
    this.header.text = "SOUP";
}

```

INSTANCE 2:

```auto
onClipEvent (enterFrame)
{
    this.header.text = "PIZZA";
}

```

The dynamically created textfield (lets call it “header”) works fine. However, i cannot seem to get the text field to change color once you roll over the instances. I’ve tried using "

```auto
on (rollover) {
this.header.textColor = 0xFFFFFF;"
}

```

, but no such luck…can anyone point me in the right direction.

Thanks.
