You could make a collection object holding your various objects (1...N) and then have a key for each object. From there you could easily make a method to get a particular item by id out of your collection.

----- Original Message -----
From: "Eric Lee" <[EMAIL PROTECTED]>
To: "'Flashcoders mailing list'" <[email protected]>
Sent: Wednesday, January 24, 2007 4:08 PM
Subject: [Flashcoders] AS3 Defining Objects

Hi list,



So I have a situation where I need to create multiple objects based on XML
data. Is there a way in AS3 that I can do something like this:



for (var i:int=0; i<numItems; i++) {

           var myObject[i]:Object = new Object();

           myObject[i].name = "Name from XML";

}



So that object would be created as myObject0, myObject1, myObject2 etc.
Since they got rid of eval in AS3, I'm not quite sure how to go about this.



Thanks!

-Eric



_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to