A child can only have one parent at a time.

I would profile the component and see if you can make it lighter.

Alex Harui
Flex SDK Developer
Adobe Systems Inc.<http://www.adobe.com/>
Blog: http://blogs.adobe.com/aharui

From: [email protected] [mailto:[email protected]] On Behalf 
Of Sébastien Tromp
Sent: Saturday, November 28, 2009 6:14 AM
To: [email protected]
Subject: [flexcoders] Reuse same instance of UIComponent in different views



Hello,

In my application, I have created an extension of a Canvas:

       class A extends Canvas

This component is rather big in memory, and needs to be displayed in several 
panels of the application at the same time. For instance, as a child of another 
Canvas and as a child of a TitleWindow simultaneously.

Currently, I recreate an instance of A every time I need it to be displayed.
Indeed, I tried to create a common instance (using a view locator pattern) and 
reuse it everywhere in my application; however if I do this, when setting this 
unique instance as a child of the TitleWindow, the "parent" property is then 
sets to the TItleWindow, and not to the Canvas anymore. As a result, it seems 
the same component can never be reused.

Do you have a solution to this? Am I using an incorrect approach to components 
reuse?

Any insight would be much appreciated.

Thanks,
--
Seb

Reply via email to