Why to trying that?
I mean there's no reson for it. You better use as3 instead of states. Even
States are wrong way uses.


Regards
Igor Costa
www.igorcosta.org

On Fri, Sep 5, 2008 at 8:33 PM, Mario Falomir <[EMAIL PROTECTED]>wrote:

>   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]>* wrote:
>
> From: luvfotography <[EMAIL PROTECTED]>
> Subject: [flexcoders] How do I move a child? from one container to another?
> To: [email protected]
> 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,
>
>   
>



-- 
----------------------------
Igor Costa
www.igorcosta.com
www.igorcosta.org

Reply via email to