Hi, you could use the descriptor property and the createComponentFromDescriptor method..
something like this: var myCanvas : Canvas = new Canvas(); //Canvas initialization... var myDataGrid : DataGrid = new DataGrid(); //DataGrid initialization... myCanvas.createComponentFromDescriptor( myDataGrid.descriptor, false ); //then you'll need to call validateNow() in order to add the datagrid //to the display... myCanvas.validateNow(); this works for me... HTH Gus --- In [email protected], "Andriy Panas" <[EMAIL PROTECTED]> wrote: > > Hi Sergey, > > Cloning of UIComponent descendants is not yet supported by Adobe's > ObjectUtil class and maybe it will not be part of Flex 3 SDK either... > > You can vote on this issue in Adobe's JIRA issue database here, maybe it can > help: > https://bugs.adobe.com/jira/browse/SDK-11293 > > > -- > -- > Med venlig hilsen / Best regards > Andriy Panas > [EMAIL PROTECTED] > > On 20/08/2007, Sergey Kovalyov <[EMAIL PROTECTED]> wrote: > > > > Hi All! > > > > Take a look at help paragraph for ObjectUtil.copy() method: > > > > *Copies the specified Object and returns a reference to the copy. The copy > > is made using a native serialization technique. This means that custom > > serialization will be respected during the copy. * > > > > *This method is designed for copying data objects, such as elements of a > > collection. It is not intended for copying a UIComponent object, such as a > > TextInput control. If you want to create copies of specific UIComponent > > objects, you can create a subclass of the component and implement a > > clone() method, or other method to perform the copy.* > > > > http://livedocs.adobe.com/flex/201/langref/mx/utils/ObjectUtil.html > > > > I completely understand this approach, though I'd prefer some abstract > > implementation, like: > > > > 1. Get class of the instance. > > > > 2. Create the new instance of that class. > > > > 3. Copy all the properties using the reflection API. > > > > 4. Copy all the style properties using newInstance.styleName = > > existingInstance. > > > > Is it possible at all? Any ideas or ready to use util methods? > > > > Thank you in advance! > > Sergey. > > > > > > >
