I don't know that repeater makes a reference array for child components
of the repeated parent.  It may, but I never do it that way.  

 

Try the component.  The refactor will take you maybe 3 minutes, and you
will never go back.

 

Tracy Spratt 
Lariat Services 

Flex development bandwidth available 

________________________________

From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
Behalf Of Jason
Sent: Thursday, February 19, 2009 4:13 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Repeaters and Referencing Component IDs

 

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <tspr...@...> wrote:
>
> The first thing I would do is crate a custom component that 
encapsulates
> the repeated UI(tree and image), and repeat that. Then I would 
create a
> setter for the image source (set imageSource()) in the repeated
> component.
> 
> 
> 
> I would give my component and id, say "myTree". Repeater would 
make an
> array of the 5 instances. Then I could do:
> 
> myTree[0].imageSource = myImageUrl;

OK thanks! I will do that, however, custom component discussion 
aside, this seems to be do-able without a custom component (even 
though yeah, I should wrap it up into one). The main point of my 
question is that it seems that, applying your example, myTree is not 
an array of several objects (demonstrated with my example) as I would 
have thought - that is the problem with my code I'm trying to figure 
out. In your example, I would think myTree be an array with a length 
of 5 (since the DP is 5 in length) - each object in the array being 
an Image (or in your example, an instance of your custom component). 
But as my example shows, it's length is 1. Best practices aside, 
from a pure coding perspective (bad as it may be), why does my 
_images array have a length of 1 instead of 5 like the DP?



Reply via email to