# Create Textboxes in AS3

**URL:** <https://forum.kirupa.com/t/create-textboxes-in-as3/264043>\
**Category:** flash\
**Created:** [June 22, 2008, 3:53pm UTC](https://forum.kirupa.com/t/create-textboxes-in-as3/264043 "2008-06-22T15:53:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![imbored531](https://avatars.discourse-cdn.com/v4/letter/i/ee59a6/32.png) [@imbored531](https://forum.kirupa.com/u/imbored531)\
**Post date:** [June 22, 2008, 3:53pm UTC](https://forum.kirupa.com/t/create-textboxes-in-as3/264043/1 "2008-06-22T15:53:21Z")

</div>

I’m trying to figure out how to create a lot of text fields with different names in AS3.

I want each text field’s name to be unit0, unit1, unit2 and so on.

Anyone have any idea how to do this with a for loop?

Here’s what I have, which returns errors.

```auto

for (i=0; i<40; i++) {
   var unit*:TextField = new TextField;
   board.addChild(unit*);
}

```

---

<div class="post-metadata">

**Author:** ![DiamondDog](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@DiamondDog](https://forum.kirupa.com/u/DiamondDog)\
**Post date:** [June 22, 2008, 4:01pm UTC](https://forum.kirupa.com/t/create-textboxes-in-as3/264043/2 "2008-06-22T16:01:39Z")

</div>

Try this

```auto
var unit:Array = new Array();

for (var i:int=0; i<40; i++) {
   unit* = new TextField();
   board.addChild(unit*);
}

```
