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], "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:[EMAIL PROTECTED] On
> Behalf Of Parjan Arjan
> Sent: Saturday, December 08, 2007 6:37 AM
> To: [email protected]
> 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> ">
>
> <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>
>