2 Replies Latest reply on Oct 14, 2008 9:55 AM by Gregory Lafrance

    Problem calling web service

      I am calling a Web service from my code and on result event getting the data and putting the data in a Dictionary as key value pair. Now another piece of code which is a for loop getting each data from dictionary and putting it in textboxes.. Now my problem is my for loop is executing before result event of web service fired. So not getting the data on the textboxes. Can i stop(by any way) program execution flow till the data come from web service. Any pointers will be very helpful.

        • 1. Re: Problem calling web service
          nijlz Level 1
          put the loop in a function that is called when the result event ist fired.

          public function handleResult(event:ResultEvent):void
          put the data in the dictionary;
          put each data of the dictionary in textboxes;

          and not:

          put each data of the dictionary in textboxes;

          I hope this is helping.
          • 2. Re: Problem calling web service
            Gregory Lafrance Level 6
            That's right. Flex is asynchronous, so you can't assume data has been received. Put the loop in the result handler, or call another function from the result handler after the data has been received and processed as desired in the event handler.