[flexcoders] Can a control be a child of more than one parent?

2008-12-04 Thread simonjpalmer
I have a set of controls that I want to share between two different
containers, one ViewStack and one Repeater.  I create the controls
inline as children of the ViewStack and then I pass their references
to a custom ItemRenderer in the Repeater.  In the custom ItemRenderer
I add them as a child.  

When I inspect the parent property in the debugger I see that it is
the itemRendererer and not their original parent.  Is that to be
expected?  Can a control be a child of more than one parent?



Re: [flexcoders] Can a control be a child of more than one parent?

2008-12-04 Thread Paul Andrews
- Original Message - 
From: simonjpalmer [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Thursday, December 04, 2008 2:50 PM
Subject: [flexcoders] Can a control be a child of more than one parent?


I have a set of controls that I want to share between two different
 containers, one ViewStack and one Repeater.  I create the controls
 inline as children of the ViewStack and then I pass their references
 to a custom ItemRenderer in the Repeater.  In the custom ItemRenderer
 I add them as a child.

 When I inspect the parent property in the debugger I see that it is
 the itemRendererer and not their original parent.  Is that to be
 expected?  Can a control be a child of more than one parent?

A control can only have one parent on the display list, though there can be 
multiple references to a control. I'm not sure if I entirely follow your 
description though.

If  you have controls sitting in two different containers, they will be 
different instances of the control.

Paul