Create Textboxes in AS3

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.


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

Try this

var unit:Array = new Array();

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