Didn't know we'd gotten around to fixing that.

 

Anyway, I ran the app and don't see any strange behavior.  addChild is a
'move' and not a 'copy' as the button label implies.

 

The best way to make a copy is to put the whole <VBox> sequence in its
own MXML file and add a new instance of it.  

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of reflexactions
Sent: Saturday, December 08, 2007 9:53 PM
To: [email protected]
Subject: [flexcoders] Re: Strange Behaviour

 

Hmm,
Well in general I have always assumed it wasnt necessary to do that 
becuase the Container addChildAt method specifically calls 
removeChild on the old container for you:

override public function addChildAt (child:DisplayObject, 
index:int):DisplayObject
{
var formerParent:DisplayObjectContainer = child.parent;
if (formerParent && !(formerParent is Loader))
formerParent.removeChild(child);

What extra does calling removeChild in you own code first do then?

tks

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Flex prefers that you call removeChild on the old container before
> calling addChild on the new container.
> 
> 
> 
> ________________________________
> 
> From: [email protected] <mailto:flexcoders%40yahoogroups.com>

[mailto:[email protected] <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Parjan Arjan
> Sent: Saturday, December 08, 2007 6:37 AM
> To: [email protected] <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Strange Behaviour
> 
> 
> 
> I HAVE TWO PANEL AND ONE BUTTON IN AN APPLIACTION ONE PANEL CONTAINS
> VBOX WHICH CONTAINS A DATAGRID
> 
> SECOND PANEL IS EMPTY 
> 
> 
> 
> I WANT TO PLACE VBOX OF PANEL ONE TO BE COPIED IN PANEL TWO BUT I
> OBSEVE A STRANGE BEHAVIOUR ITS IS REMOVED FROM PANEL ONE CAN U TELL 
ME
> WHY HERE IS MY CODE.
> 
> 
> 
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> 
> <http://www.adobe.com/2006/mxml <http://www.adobe.com/2006/mxml> > ">
> 
> <mx:Panel id="PANEL1" title="Panel One">
> <mx:VBox id="vbx">
> <mx:DataGrid >
> <mx:ArrayCollection>
> <mx:Object>
> <mx:Artist>Pavement</mx:Artist>
> <mx:Price>11.99</mx:Price>
> <mx:Album>Slanted and Enchanted</mx:Album>
> </mx:Object>
> </mx:ArrayCollection>
> </mx:DataGrid> 
> </mx:VBox>
> 
> </mx:Panel>
> 
> <mx:Panel id="PANEL2" title="Panel Two">
> </mx:Panel>
> 
> <mx:Button label="Copy VBOX" click=" {PANEL2.addChild( vbx ) } "/>
> 
> </mx:Application>
> 
> 
> 
> ________________________________
> 
> Never miss a thing. Make Yahoo your homepage.
> <http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs
<http://us.rd.yahoo.com/evt=51438/*http:/www.yahoo.com/r/hs> >
>

 

Reply via email to