the <mx:State name="init"/> line is pointless I forgot to remove it :)
--- On Fri, 9/5/08, Mario Falomir <[EMAIL PROTECTED]> wrote: From: Mario Falomir <[EMAIL PROTECTED]> Subject: Re: [flexcoders] How do I move a child? from one container to another? To: flexcoders@yahoogroups.com Date: Friday, September 5, 2008, 5:33 PM I made this example, hope it helps :) <?xml version="1.0" encoding="utf- 8"?> <mx:Application xmlns:mx="http: //www.adobe. com/2006/ mxml" layout="absolute"> <mx:states> <mx:State name="moveit"> <mx:RemoveChild target="{text1} "/> <mx:AddChild relativeTo=" {myPanel} " target="{text1} "/> </mx:State> <mx:State name="init"/> </mx:states> <mx:Panel width="188" height="178" x="250" y="53" id="myPanel"> </mx:Panel> <mx:Text x="329" y="27" text="Text" id="text1"/> <mx:Script> <![CDATA[ private function changeView(e: MouseEvent) :void { if ( currentState != "moveit" ) currentState = "moveit"; } ]]> </mx:Script> <mx:Button x="278" y="239" label="Change View State" height="50" click="changeView( event)"/> </mx:Application> --- On Fri, 9/5/08, luvfotography <[EMAIL PROTECTED] digital-links. com> wrote: From: luvfotography <[EMAIL PROTECTED] digital-links. com> Subject: [flexcoders] How do I move a child? from one container to another? To: [EMAIL PROTECTED] ups.com Date: Friday, September 5, 2008, 5:03 PM Hi, I'm trying to use States and removing(RemoveChil d) a child (mx:Text id='mytext') and trying to add it to a different container with addchild, but I get an error - ' identifier 'mytext' used more than once I can do this in actionscript, but how do I do this in mxml, keeping the same id of 'mytext' on the text field?? <mx:State name="moveit" > <mx:RemoveChild target="{mytext} "/> <mx:AddChild relativeTo=" {myhbox}" position="firstChil d"> <mx:Text id="mytext" paddingTop=" 0" fontSize="16" width="100%" /> </mx:AddChild> </mx:State> thanks,