1 Reply Latest reply on Jan 5, 2007 4:09 PM by FlightGuy

    Change States in component from main view

      The scenario like this:

      The main view includes many component views. On my main view there have a radio button to choice different role type, for example: admin and user. For different role have different views. But they don’t have big difference.

      My question is how could I implement my component view change states when I click button on the main view? I don’t want do change states in main view since I need create two component views for different roles.

        • 1. Re: Change States in component from main view
          Consider adding a second state to your application, even if you don't put anything into it.

          In each of the components that should change state when the role is changed, add a listener on the application for the state change event ("currentStateChange"). When this event is fired, query the application for its current state:

          var appState:String = (Application.application as Application).currentState;

          Use that to change the state of the component. Remember you'll also need to do this when your component is first created.