--- In flexcoders@yahoogroups.com, David Pariente <[EMAIL PROTECTED]> 
wrote:
>
> Wow, that answer will really help me! :)
> 
> What if it's not movies, but some other object that i wanna create 
20 times?
> I thought it should get inside some kind of Array, but not sure if 
its this way too.
> 
> i.e. 
> 
> var MyTextBox:TextBox=new textBox();
> 
> what if i need N instances of that MyTextBox? Should i create an 
Array before that? What's the right way to put those  textBoxes into 
the  Array?
> 
> I'm sorry for the basic of my question....but im quite new to AS3 
and OOP, and i did use and misuse of evals a lot in AS1 and AS2.
> 
> Thanx a lot for the help :)

If you use a repeater, this will happen automatically:

<mx:Repeater dataProvider="{yourArrayColl}>
   <mx:TextBox id="MyTextBox" />
</mx:Repeater>

will give you an array of TextBoxes that you can access with

MyTextBox[0] - MyTextbox[n], where n is the number of items in your 
data source.

You can also do this manually

var MyTextBox:Array;

for (i=0;i<=numLoops;i++){
   MyTextBox.push(new TextBox());
}

You'd refer to them the same as above.

HTH;

Amy

Reply via email to