# Dynamically create TextFields and still access them

**URL:** <https://forum.kirupa.com/t/dynamically-create-textfields-and-still-access-them/284332>\
**Category:** flash\
**Created:** [March 18, 2009, 4:10am UTC](https://forum.kirupa.com/t/dynamically-create-textfields-and-still-access-them/284332 "2009-03-18T04:10:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bortiquai](https://avatars.discourse-cdn.com/v4/letter/b/c5a1d2/32.png) [@bortiquai](https://forum.kirupa.com/u/bortiquai)\
**Post date:** [March 18, 2009, 4:10am UTC](https://forum.kirupa.com/t/dynamically-create-textfields-and-still-access-them/284332/1 "2009-03-18T04:10:28Z")

</div>

in AS3, How can I dynamically create TextFields and still be able to access them individually?

for example, a for/next loop creates 3 textFields:

for (var num:Number = 0; num\<3; num++){  
var txtFld:TextField = new TextField;  
txtFld.text = ‘This is the original text’;  
this.addChild(txtFld);  
}

now say later on, I want to change the text of one of the textfields:  
txtFld.text = ‘This is the new Text’;

The problem is, in the variable list, there is only one txtFld, the last one created. How can I access the other textFields?

Thanks
