# \[MX\] Another problem with waiting for data

**URL:** https://forum.kirupa.com/t/mx-another-problem-with-waiting-for-data/162792
**Category:** Uncategorized
**Created:** [September 16, 2005, 10:35am UTC](https://forum.kirupa.com/t/mx-another-problem-with-waiting-for-data/162792 "2005-09-16T10:35:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CEOofAEP](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@CEOofAEP](https://forum.kirupa.com/u/CEOofAEP)
#### Post date: [September 16, 2005, 10:35am UTC](https://forum.kirupa.com/t/mx-another-problem-with-waiting-for-data/162792/1 "2005-09-16T10:35:36Z")

</div>

I already kind of adressed this problem before and [Ko2n](http://www.kirupa.com/forum/member.php?u=5850) helped me to find a partial solution but now I’m running into a wall again.

Here’s the original post:  
**[http://www.kirupa.com/forum/showthread.php?t=191625](http://www.kirupa.com/forum/showthread.php?t=191625)**

Now the problem is the following: How would I successfully structure a function that needs to do this:

[list=1]  
[_]load an xml file (which triggers another function through “onLoad”).  
[_]\*\*WAIT \*\*for the value returned by that triggered function.  
[_]do not commence any other steps until the value is retrieved,  
[_]_do not_ leave the function immediately (maybe until a timeout ends)  
[/list]I’m thinking that maybe some sort of “setInterval” might be pointing the right direction… but I don’t know how to do it right.

This is the code from the function so far:[AS]if (\_root.current\_day == undefined) { \_root.current\_day = 0;  
// this triggers a function that will set  
// “\_root.selected\_day” to a value:  
xml\_current.load(file\_current);  
}[/AS]Then comes some code that won’t work unless I have a value higher than “0” in “\_root.selected\_day”… but I can’t just check if I have that value…

Because if I check something like:[AS]if (\_root.current\_day != 0) {  
// Blah  
}[/AS]It checks “\_root.current\_day” \ ***once** \*and then it just skips the whole next part (the “if”-clause) in case it doesn’t match.

Any ideas? Is there really no easy way to tell flash to wait with the rest of a function until a value exists? I don’t understand this.

Thanks in advance 🙂
