# For loop question

**URL:** <https://forum.kirupa.com/t/for-loop-question/222273>\
**Category:** Uncategorized\
**Created:** [April 12, 2007, 5:26am UTC](https://forum.kirupa.com/t/for-loop-question/222273 "2007-04-12T05:26:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sumo](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sumo/32/1950_2.png) [@sumo](https://forum.kirupa.com/u/sumo)\
**Post date:** [April 12, 2007, 5:26am UTC](https://forum.kirupa.com/t/for-loop-question/222273/1 "2007-04-12T05:26:27Z")

</div>

Hi!

I have a simple form in Flash and I would like to apply some functions to my textfields. I would like to do it with a loop so that I wouldn’t have to add another function everytime i add another textfield.

Here are the functions:

```auto

myTextfield1.onSetFocus = function()
{
    textField_bg_1.gotoAndPlay("over");
    if(myTextfield1.text == myString1)
    {
        myTextfield1.text = "";
    }
}

myTextfield1.onKillFocus = function()
{
    textField_bg_1.gotoAndPlay("out");
    if(myTextfield1.text == "")
    {
        myTextfield1.text = myString1;
    }
}

```

Those Movieclips and varables that have a number 1 after them are the ones that would repeat in every loop. Anyone can help me?

-sumo-
