Yes, this is the right way. You should avoid using getChildByName() because Flex 'owns' the name property and you shouldn't assume that the name will always be equal to the id. - Gordon
________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Spratt Sent: Monday, March 12, 2007 9:00 AM To: [email protected] Subject: RE: [flexcoders] how to create reference variable to mxml objects? I think this will be better: ref = this["pic" + i]; ref.x = 100; Tracy ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Roman Protsiuk Sent: Monday, March 12, 2007 7:40 AM To: [email protected] Subject: Re: [flexcoders] how to create reference variable to mxml objects? ref = "pic" + i; Image(getChildByName(ref)).x = 100; R. On 3/12/07, dougco2000 <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Perhaps a silly question, but how do you create a reference in AS to point to an object, i.e. an Image? For example, if you have in the mxml: <mx:Image id="pic1" source="images/thisimage.png" /> <mx:Image id="pic2" source="images/thatimage.png" /> <mx:Image id="pic3" source="images/nextimage.png" /> And I want to be able to do something like this in a function: ref = "pic" + i; ref.x = 100; I ended up just creating all the image object in AS through a loop/array and then could easily do this, but I am curious to know if what I was originally trying to do is possible. thanks

