3 Replies Latest reply on Apr 18, 2013 10:12 PM by Flex harUI

    When I change state the UI does not update


      I have some code that uses state changes to manage the buttons in a login screen:


                      <!-- Default state: the LoginWindow accepts input from the user -->



                      <!--  Login

                              login is in progress.

                              No input allowed other than the "Cancel" button


                      <mx:State name="{STATE_LOGIN}">

                              <mx:SetProperty target="{loginForm}" name="enabled" value="false"/>

                              <mx:SetProperty target="{loginButton}" name="enabled" value="false"/>

                              <mx:SetProperty target="{cancelLoginButton}" name="enabled" value="true"/>

                              <mx:SetProperty target="{statusLabel}" name="text"




      The problem is that when I change the state by setting currentState to STATE_LOGIN the UI change does not happen right away. In fact it doesn't take place until the login event is complete, creating a race condition.

      However, I've been able to work around this problem by explicitly setting the values of loginButton.enabled and cancelLoginButton.enabled in my program:

                loginButton.enabled = false;

                cancelLoginButton.enabled = true;

      When I do this, the buttons are enabled in the right way.

      Why does explicitly setting the button enabled flags work, but the state change, which should do the same thing, not?