1 Reply Latest reply on May 5, 2010 7:40 AM by David_F57

    Adobe FLEX State Handling Using FB 3.

    maazqureshi

      Hi to all.

      I am new to flex , having a problem with states working .

      i am able to go to sub state but unable to go to base state.


      Kindly view code, and suggest how to set <Base State> as current state.


      Thanks.

       

      <mx:states>

      <!--<mx:SetEventHandler target="{btn2}" name="click" handler="currentState='';"-->

       

      <mx:State name="AddNew">

      <mx:SetProperty    target="{btn1}" name="label" value="Ok"/>

      <mx:SetProperty target="{btn2}" name="label" value="Cancel"/>

      <mx:SetProperty target="{panel1}" name="title" value="Welcome New User."/>

      <mx:RemoveChild target="{lblpasshlp}"/>

      <mx:RemoveChild target="{imgbox}"/>

      <mx:SetEventHandler

      target="{btn1}"

      name="click"  handler="AddNew()"/>

      <mx:SetEventHandler target="{btn2}" name="click" handler="currentState='';"/>

      <mx:AddChild position="lastChild" target="{panel1}"/>

      <mx:SetProperty name="width" value="315"/>

      <mx:SetProperty name="height" value="215"/>

      <mx:SetProperty target="{panel1}" name="width" value="295"/>

      <mx:SetProperty target="{panel1}" name="height" value="195"/>

      <mx:SetProperty target="{lblmessage}" name="x" value="165"/>

      </mx:State>

       

      <mx:State name="LoginFailed">

      <mx:SetProperty name="height" value="215"/>

      <mx:RemoveChild target="{btn2}"/>

      <mx:SetProperty target="{lblUN}"  name="text" value="Your Question"/>

      <mx:SetProperty target="{lblpass}"  name="text" value="Your Answer"/>

      <mx:SetProperty target="{btn1}" name="label" value="Check"/>

      <mx:SetProperty target="{lblmessage}"  name="text" value="Authentication"/>

      <mx:SetProperty target="{lblmessage}"  name="x" value="174"/>

      <mx:RemoveChild target="{lblpasshlp}"/>

      <mx:RemoveChild target="{imgbox}"/>

      <mx:SetProperty name="width" value="315"/>

      <mx:SetEventHandler target="{btn1}" name="click" handler="currentState='ResetPassword'"/>

      <mx:SetProperty target="{panel1}" name="title" value="Login Failed"/>

      </mx:State>

       

      <mx:State name="ResetPassword" basedOn="LoginFailed">

      <mx:SetProperty target="{lblUN}" name="text" value="New Password"/>

      <mx:RemoveChild target="{lblpass}"/>

      <mx:RemoveChild target="{txtPassword}"/>

      <mx:SetProperty target="{btn1}" name="label" value="Update"/>

      <mx:SetProperty target="{lblmessage}" name="text" value="Reset Password"/>

      <mx:SetProperty name="width" value="315"/>

      <mx:SetProperty name="height" value="215"/>

      <mx:SetStyle name="horizontalAlign" value="center"/>

      <mx:SetStyle name="verticalAlign" value="middle"/>

      <mx:SetProperty target="{panel1}" name="title" value="Change Password"/>

      <mx:SetProperty target="{panel1}" name="width" value="295"/>

      <mx:AddChild relativeTo="{panel1}" position="before" target="{panel1}"/>

      </mx:State>

       

       

           </mx:states>