# Unique names for textField created in for each loop

**URL:** <https://forum.kirupa.com/t/unique-names-for-textfield-created-in-for-each-loop/310947>\
**Category:** flash\
**Created:** [June 23, 2010, 5:55pm UTC](https://forum.kirupa.com/t/unique-names-for-textfield-created-in-for-each-loop/310947 "2010-06-23T17:55:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaioxung](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jaioxung](https://forum.kirupa.com/u/jaioxung)\
**Post date:** [June 23, 2010, 5:55pm UTC](https://forum.kirupa.com/t/unique-names-for-textfield-created-in-for-each-loop/310947/1 "2010-06-23T17:55:51Z")

</div>

I have an for each loop that creates a new textField for each item and I need to know how you can give each textField a unique name so it can be targeted later on.

Here is the relevent code:

```auto

var i:int = 1;
for each (var titleElement:XML in titleList) {

var header: TextField = new TextField ();
addChild(header);
header.text = titleElement;

i++
}
}

```

I would like to append the value of “i” to the end of the variable “header” i.e. “header\_1”.

Thanks in advance for the help.
