3 Replies Latest reply on May 1, 2009 6:55 AM by ATIF FAROOQ

    State transitions from Modules


      My application.mxml defines my state transitions and loads a couple of modules at startup - GuestSearch and GeneralInformation. In the GuestSearch, there is a button that when clicked, should remove the GeneralInformation module on the right and replace it with a different third module, GuestSearchResults. I'm new to Flex, so I haven't quite got my mind around the proper way to handle application flow.



              <mx:State name="GuestSearch"> // initial state
                  <mx:AddChild relativeTo="{leftSide}" position="lastChild">
                  <mx:AddChild relativeTo="{rightSide}" position="lastChild">
              <mx:State name="GuestSearchResults"> // state to go to after button click in module1
                  <mx:RemoveChild target="{rightSide}"/>
                  <mx:AddChild relativeTo="{rightSide}" position="lastChild">


          <mx:Canvas x="0" y="54" width="100%" height="100%" backgroundColor="#8591C2">
                  <mx:ConstraintColumn id="col1" width="300"/>
                  <mx:ConstraintColumn id="col2" width="100%" />
              <mx:Canvas id="leftSide" left="col1:7" top="9" bottom="9" right="col1:4"/>
              <mx:Canvas id="rightSide" left="col2:4" top="9" bottom="9" right="col2:7"/>


      My question is since this information is defined in my application.mxml, how can clicking on the button in the GuestSearch module reference the states defined in the application.mxml so as to swap modules?


      Thanks for the help