# Deleting TextField.onChanged

**URL:** <https://forum.kirupa.com/t/deleting-textfield-onchanged/192563>\
**Category:** flash\
**Created:** [June 29, 2006, 1:13pm UTC](https://forum.kirupa.com/t/deleting-textfield-onchanged/192563 "2006-06-29T13:13:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [June 29, 2006, 1:13pm UTC](https://forum.kirupa.com/t/deleting-textfield-onchanged/192563/1 "2006-06-29T13:13:02Z")

</div>

Basically I have a few functions to check to see how many lines of text the user types into a text box.

If the text exceeds 1 line I make the text box red, once they click in the text box again to shorten their input I change it back to white.

So I’m using the following code

```auto

    // nick name
    if(temp_pref_name_height > maxHeight){
        _root.main_clip.panel_set.contactPanel.form_pref_name.backgroundColor = 0xFF0000;
        _root.main_clip.panel_set.contactPanel.form_pref_name.onChanged = function(){
            _root.main_clip.panel_set.contactPanel.form_pref_name.backgroundColor = 0xFFFFFF;
            trace("Go back to white");
        }
        trace("2 Lines");
    }else{
        trace("1 Line");
    }

```

But each time the user type’s a character it recalls what’s inside the onChanged function.

I only want what’s in their to be called once until until the user hit’s submit again. So my question is how can I delete this function or better yet only call it the first time the user clicks in the text box.  
I hope I made sense, this seems like such a simple task but I can’t seem to find any solutions.

-thanks
