Thank you for your suggestion but the problem is not on the AJAX. I use AJAX a lot too and all already using its own on 'tag' completed. I never use AJAX on any completed. I've also been using a lot of signaling, so far so good.
I've boiled down my problem and I think the problem is because the return value is only available after some ticks, so the caller already "expired", thus the return value is not returned to the right caller. So this probably is because of my method, not what I originally thought that return value applies to all functions globally.
I run some test with 2 methods, a main body which call for 2 functions, and the function A and B itself, each wait for 1 second before returning the value (simulating this function requires some ticks to complete). Here's what I tried:
-----FUNCTION A (NOT WORKING)-----
function run_A {
wait 1.0 second
set return value to "result of A"
}
-----FUNCTION B (WORKING)-----
function run_B {
set return value to "result of B"
}
void main() {
on button clicked {
set var A to Function.Call("run_A");
set var B to Function.Call("run_B");
}
}
[/code:33fw5n67]
Result:
[code:33fw5n67]A = 0
B = "result of B"[/code:33fw5n67]
I'm guessing that on my project, because both functions takes some ticks to complete, the return value isn't received by the caller. So my question is, how can I return a value that is not available at an instant or should I use other method than return value (static var and signaling perhaps)?