1 Reply Latest reply on Aug 10, 2009 6:34 AM by Gregory Lafrance

    wait for a function to finish

    quebequiano Level 1

      Hi!

       

      I am working with Flex and Remote Objects (Java Classes). The problem i have is: the action script don't wait for the return of a function. I mean:

       


                      value=loginRO.login(idField.text, passwordField.text, message);

       

                      if (value == 1){
                          connectionState.text="CONNECTED";
                          messageState.text=message;
                      }
                      else{
                          connectionState.text="NOT CONNECTED";
                          mx.controls.Alert.show("There was an error trying to log in", "CONNECTION FAILED");
                          messageState.text=message;
                      }

       

      If the login is succesful you will get a "1" from the call, and "0" in other case. But the flex code always displays the "else" because it doesnt wait for the "login" function to finish its execution. What should i do?