1 Reply Latest reply on Oct 19, 2009 9:59 AM by acath

    Change components parent state

    robertoCostaRica

      Let say there are two states in the main application.

       

      appState1 and appState2.

       

      Then there is a subcomponent subComp in the application which has two states.

       

      subCompState1 and subCompState2

       

      subComp also has a small subComponent called changeMenu

       

      changeMenu in subCompState1 wants to change subCompState1 to subCompState2 using an internal button.

       

      This is no posible since the states are no displayed in the interactions panel,  however in the list of posible states appState1 and appState2 do appear.

       

      What I do to work around this is add a button in the root of subComp, so that it can switch between states.

       

      My first question is how do you change the state of a parentComponent is posible.

       

      My second question is: Am I doing something wrong so that I get AppState1 and AppState2 but not the states from other components in the interactions panel.

       

      thanks

      roberto

        • 1. Re: Change components parent state
          acath Level 4

          Buenos Dias Roberto,

           

          You haven't missing anything. Catalyst doesn't support setting the state of distantly-related components. This is basically to keep things simple, although it does seem to be blocking more advanced users.

           

          Having a component set the state of a distant component is bad programming practice. We think (although we could be wrong) that developers will want to create a more robust architecture when applications get to that level of complexity. Since we haven't figured out how to make that push-button simple, we simply allow you to do it yourself in Flash Builder. Of course, that means you'll have to write some code.

           

          In the meanwhile, you're stuck with your workaround...

           

          -Adam