1 Reply Latest reply on Apr 25, 2011 11:11 AM by Lee Burrows

    Flex 4.5 Mobile Login Form needs 2 clicks???

    anixan

      Hi,

       

      I have been working on developing an application for the android market thta firstly requires the users to login to a account. I have put the code together below, along with a data link to a database in order to check the credentials. However the application does not switch to the second view on the first click of the "Login" button however it seems to take 2 or more clicks sometimes. I presume as it is fetching data from a database that it takes time to be verifies, could someeone tell me how to solve this and maybe implement a BusyIndicator along with it?

       

      <![CDATA[
                     protected function login_btn_clickHandler(event:MouseEvent):void
                     {
                          var match:Boolean;
                          
                          getEmployeesByNameResult.token = employeeService.getEmployeesByName(usr_nme_txtbox.text, pass_txtbox.text);
                          
                          if (getEmployeesByNameResult.lastResult != null)
                          {
                               navigator.pushView(HomeView, getEmployeesByNameResult.lastResult.id);
                          }
                     }
                ]]>
      

       

       

      <s:Button id="login_btn" width="100%" label="Login"
                                      click="login_btn_clickHandler(event)"/>
      

       

      Thanks

        • 1. Re: Flex 4.5 Mobile Login Form needs 2 clicks???
          Lee Burrows Level 4

          hi

           

          try putting the pushView code inside the result handler for employeeService - currently you are checking login details immediately but as you say, you need to wait for the server response (which will trigger the result handler)

           

          the easiest way to handle busy indicator is probably to use states - ie: a 'login' state that shows the login controls and a "busy" state that displays "connecting" or some other indicator for the user. then switch states at the appropriate time