Use relativeTo instead of target:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
layout="absolute"
creationComplete="initData()">
<mx:Script>
  <![CDATA[

   private var welcomeScreen:denemeci;
   private function initData():void{
    currentState='first';
   }

  ]]>
</mx:Script>
<mx:states>
  <mx:State name="first">
   <mx:AddChild relativeTo="{targetBox}">
    <mx:Label text="hello world" />
   </mx:AddChild>
  </mx:State>
  <mx:State name="second">
   <mx:AddChild relativeTo="{targetBox}">
    <mx:Label text="byebye world" />
   </mx:AddChild>
  </mx:State>
</mx:states>
<mx:HBox width="100%">
  <mx:VBox id="targetBox" height="100" width="100"/>
  <mx:Button click="currentState='first'" />
  <mx:Button click="currentState='second'" />
</mx:HBox>
</mx:Application>

--- In flexcoders@yahoogroups.com, "oktay nba" <[EMAIL PROTECTED]> wrote:
>
> hi everyone;
> i can't change states. i write a simple code, but i can't work it
too. is it
> a bug of flex or flash player?
> here is the code:(in flex 2 beta2 it is done well but in beta 3 it
sucks)
> -------------------------------------------------------------------
--------------
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*"
> layout="absolute"
>  creationComplete="initData()">
>  <mx:Script>
>   <![CDATA[
>
>    private var welcomeScreen:denemeci;
>    private function initData():void{
>     currentState='first';
>    }
>
>   ]]>
>  </mx:Script>
>  <mx:states>
>   <mx:State name="first">
>    <mx:AddChild target="{targetBox}">
>     <mx:Label text="hello world" />
>    </mx:AddChild>
>   </mx:State>
>   <mx:State name="second">
>    <mx:AddChild target="{targetBox}">
>     <mx:Label text="byebye world" />
>    </mx:AddChild>
>   </mx:State>
>  </mx:states>
>  <mx:HBox width="100%">
>   <mx:VBox id="targetBox" height="100" width="100"/>
>   <mx:Button click="currentState='first'" />
>   <mx:Button click="currentState='second'" />
>  </mx:HBox>
> </mx:Application>
>
> -------------------------------------------------------
>
> Oktay Caglar
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com




SPONSORED LINKS
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




Reply via email to