# \[F9\] Changing TextInput background color dynamically

**URL:** <https://forum.kirupa.com/t/f9-changing-textinput-background-color-dynamically/292702>\
**Category:** flash\
**Created:** [July 17, 2009, 6:35pm UTC](https://forum.kirupa.com/t/f9-changing-textinput-background-color-dynamically/292702 "2009-07-17T18:35:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![szodjo](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@szodjo](https://forum.kirupa.com/u/szodjo)\
**Post date:** [July 17, 2009, 6:35pm UTC](https://forum.kirupa.com/t/f9-changing-textinput-background-color-dynamically/292702/1 "2009-07-17T18:35:20Z")

</div>

Hello,  
I’m having issues changing a TextInput background color after the initial onLoad using AS2.

On load, I have no issues setting the background color with this code:

```auto

onClipEvent (load) {
    this.background = true;
    this.backgroundColor = 0x1E1C1C;
}

```

However, I have a form validator run when focus is lost but yet I cannot set the background color at that point. For example, I’m trying to set the background color to orange and text to white if the field’s contents are invalid. Even something simple like this doesn’t affect the colors.

```auto

on (focusOut) {
        this.backgroundColor = 0xFAA523;
        this.borderColor = 0xFAA523;
        this.borderStyle = "solid";
        this.color = 0xFFFFFF;
        this.text = 'Enter your first name';
}

```

All code is in actions for the TextInput itself.

Anyone know what I’m doing wrong?

Thanks in advance!
