--- In flexcoders@yahoogroups.com, "Jason" <[EMAIL PROTECTED]> wrote:
>
> Thanks Alex and Mike, I was kinda starting to suspect I needed to 
do 
> it that way, even as I was writing the e-mail.  Makes perfect 
sense, 
> I'll do that. Thanks!

It's not best practice, but you absolutely can pass references to 
things outside an object's scope into the object.  I did this with a 
component I wanted to "reparent," i.e. I had a series of components 
duplicated in a Repeater, and when you clicked on one of them, it 
would grab the component I'd passed a reference to and add it to 
itself.  I was doing this to make something that looked like an 
Accordion but could take a dataprovider and recycle the same object 
rather than having multiple copies.

Essentially, you just put a property on the component with type 
UIComponent and push it in through the ClassFactory if it is an 
itemRenderer or you can set it directly if it is not.

If you set up an interface that the component you are referring to 
has to adhere to, you can actually do this without requiring tight 
coupling.  I didn't need to worry about that, because the only thing 
I did was addChild().  However, you may want to consider just having 
the components bound to the same data and have the data push the 
changes.

HTH;

Amy



Reply via email to