eval() hasn't been needed for some time (since bracket[] notation
introduced). Just need to remember that you can't type the properties of a
plain Object:

               var numItems:int = 10;

               var myObject:Object = new Object();

               for (var i:int=0; i<numItems; i++) {
                   myObject[i] = new Object();
                   myObject[i].name = "Name from XML - "+i;
                   trace( "myObject["+i+"].name: "+myObject[i].name );

               }

On 1/24/07, Eric Lee <[EMAIL PROTECTED]> wrote:

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




--

: : ) Scott
_______________________________________________
[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