2 Replies Latest reply on Aug 27, 2010 1:18 AM by kiran7881

    What containers do we need to use when working Flex 3 States

    kiran7881 Level 1

      Hi ,

       

      My question is , when mx:states is defined in  any other container , other than mx:Aplication , it is showing an Compile ime Error.

      Please check my code and let me know , whats the problem is :

       

      I am working with Flex 3 States . This is  my sample Program , which is working absolutely fine :
      As you can see that the states are defined under the Application container .

       

      <mx:Application
          xmlns:mx="http://www.adobe.com/2006/mxml"
          currentState="bad">
         
         
          <mx:states>

              <mx:State name="bad">
                  <mx:SetProperty target="{label1}" name="text" value="Bad Day!"/>
                  <mx:SetProperty target="{linkbutton1}" name="label" value="Go Good"/>
              </mx:State>

              <mx:State name="vgood" >
                      <mx:SetProperty target="{linkbutton1}"  name="label" value="Go Good"/>
              </mx:State>

          </mx:states>

       

      The code which is not working is below :
      Here i am putting states defination under the <mx:Form> Container .
      Basically i want to show one state whne displaying the Form so i tried as <mx:Form currentState='bad'>

       

      please let me know why this is wrong


      <mx:Form>
          <mx:states>

              <mx:State name="bad">
                  <mx:SetProperty target="{label1}" name="text" value="Bad Day!"/>
                  <mx:SetProperty target="{linkbutton1}" name="label" value="Go Good"/>
              </mx:State>

              <mx:State name="vgood" >
                      <mx:SetProperty target="{linkbutton1}"  name="label" value="Go Good"/>
              </mx:State>

          </mx:states>

      <mx:Form>

      Please tell me why this isn't possible ??