Hi all,
I have this bit of code that does some simple things, but my timing is off. What I do is I make a webservice call to some server, and the server returns me a string of XML. After that, I parse that string of XML into an XMLDocument object, to use as a data provider for a repeater. That's it. Here is a simple version of my code.
WebserviceCall(); // this function returns the result as an XML string and puts it
// into a String variable called string_result on event.COMPLETE
xml_result.parseXML(string_result);
my_repeater.dataProvider = xml_result;
So this al works fine when I do each one of these steps separately. But when I try to do them in succession, I get an error on the line that tried to parse the XML. This is because it takes a while for the server to return the XML result and put it into string_result. So, when the application tries to execute the next line, it tries to parse an empty string into XML, which obviously fails on me.
What I tried already, was putting a simple loop in before the parse call to make sure that the String is not null...
while (!string_result); // wait until string is not null before continuing
...but this eats up my resources and crashes the browser. So, I am wondering if there is a sleep function in ActionScript, so that I could go...
while (!string_result) sleep(1); // sleep for 1 second before repeating loop
// hopefully this won't stress the system as much
So that's my plan of attack. I know that sleeps are kind of "hack" fixes, so any other suggestions are welcome!
Thanks in advance!
Charles
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
| Web site design development | Computer software development | Software design and development |
| Macromedia flex | Software development best practice |
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

