[MX] Another problem with waiting for data

I already kind of adressed this problem before and Ko2n 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

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 :slight_smile: