# I can't make a dynamic textfield interactive

**URL:** <https://forum.kirupa.com/t/i-cant-make-a-dynamic-textfield-interactive/307799>\
**Category:** flash\
**Created:** [April 10, 2010, 4:37pm UTC](https://forum.kirupa.com/t/i-cant-make-a-dynamic-textfield-interactive/307799 "2010-04-10T16:37:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [April 10, 2010, 4:37pm UTC](https://forum.kirupa.com/t/i-cant-make-a-dynamic-textfield-interactive/307799/1 "2010-04-10T16:37:16Z")

</div>

Hi there,

I’ve created a loop that will create dynamic textfields by using the information from an array.

This is how I did it:

```auto
var bigWordsArray:Array=['Services','creative content','previous clients'];
var myTextField:TextField = new TextField();
var myFormat:TextFormat = new TextFormat();

for (var i:int = 0; i < bigWordsArray.length; i++) {
	trace (bigWordsArray*);
	
	myTextField = new TextField();
	addChild(myTextField);	
	myTextField.text = bigWordsArray*;
	//myTextField.x = 200*i;
	myTextField.y = 40*i;
	myTextField.selectable = false;
	myTextField.background = true;
	myTextField.autoSize = TextFieldAutoSize.LEFT;
	
	myFormat = new TextFormat();
	myFormat.size = 24;
	myTextField.setTextFormat(myFormat);
}

```

Now I want to be able to make each textfield interactive (a button). But I have no idea how identify them within this loop. How can I apply an instance name to each textfield?

I \*\*thought \*\*I had to use something similar to this:

```auto
var btn:MovieClip=bigWordsArray["btn"+i];
btn.addEventListener(MouseEvent.CLICK, onButtonClick);
btn.buttonMode=true;
btn.mouseChildren=false;
btn.id=i;
	
function onButtonClick(e:MouseEvent):void {
	trace ("Do something");
}

```

I wish I understood AS3 more!

Thanks

Mark
