title: AS3 - How to do a synchronous load of an asynchronous call?
body: <p>I have a function that loads a user object from a web service asynchronously.</p>
  
  <p>I wrap this function call in another function and make it synchronous.</p>
  
  <p>For example:</p>
  
  <pre><code>    private function getUser():User{
              var newUser:User;
              var f:UserFactory = new UserFactory();
  
              f.GetCurrent(function(u:User):void{
                  newUser = u;
              });
  
              return newUser;
          }
  </code></pre>
  
  <p>UserFactory.GetCurrent looks like this:</p>
  
  <pre><code>public function GetCurrent(callback:Function):void{ }
  </code></pre>
  
  <p>But my understanding is there is no guarantee that when this function gets called, newUser will actually be the new user??</p>
  
  <p>How do you accomplish this type of return function in Flex?</p>