> I understand that arrays can hold references to components
> so I've recoded to push and pop the images from ImageArray
> to set the properties on the individual Images.

You shouldn't have to push and pop anything. If the ith element of the array is 
a reference to an Image instance, then setting imageArray[i].source in a loop 
should work fine. What are you setting it to, and how does it not work?

Gordon Smith
Adobe Flex SDK Team


From: [email protected] [mailto:[email protected]] On Behalf 
Of smitade
Sent: Friday, February 27, 2009 11:31 AM
To: [email protected]
Subject: [flexcoders] Re: Define repeaters at runtime


--- In [email protected]<mailto:flexcoders%40yahoogroups.com>, Gordon 
Smith <gosm...@...> wrote:
>
> So that the doc team understands... What is it that you found
surprising? That an Array can hold anything, including references to
components?
>
> Gordon Smith
> Adobe Flex SDK Team
>
> From: [email protected]<mailto:flexcoders%40yahoogroups.com> 
> [mailto:[email protected]<mailto:flexcoders%40yahoogroups.com>]
On Behalf Of smitade
> Sent: Thursday, February 26, 2009 9:50 PM
> To: [email protected]<mailto:flexcoders%40yahoogroups.com>
> Subject: [flexcoders] Re: Define repeaters at runtime
>
>
> It works - please ignore the previous post. Wow, the ability to push
> components into arrays like this opens up so many possibilities -
> especially when working with flex frameworks. I find it strange the
> documentation doesn't highlight this feature - otherwise I missed it.
> Thanks again!
>

Gordon - sorry for the confusion - I'm confused myself! When I started
this thread I was looking for a way to dump components into an Array
e.g. 64 Images into an array ImageArray so that I could set the
properties of the images by setting the array directly e.g.
for (i=0;i<64;i++)
{
ImageArray[i].source="some.png";
}

I mistakenly thought it was working as initially all of the 64 images
have the same source and this was showing up correctly. What I found
out that this is not the case (and probably why I didn't find it in
the docs). I understand that arrays can hold references to components
so I've recoded to push and pop the images from ImageArray to set the
properties on the individual Images. I liked the functionality of
using a repeater defined in MXML where I could reference my
"ImageArray" directly. I haven't found a way to define this repeater
at runtime though.

Sorry for the long reply - hope it makes sense.

Reply via email to