However, the globals change regularly and are always defined.
How could I wait for a _global to CHANGE its current value?
I could probably undefine them first, and then define them again, and thus use this code.
But since undefining a _global also takes time, the code could move on before it is undefined and use the old value.
Difficult one, huh? What a screwed up problem - Im pretty sure AS is the only programminglanguage that lets the code continue without having set the variables first LOOOL
Yep, puh I dont think Ive ever done so much debugging before. Im very close to a nervous breakdown right now :crazy:
Process1:
I put the _globals to “0” before entering a if-else loop.
I redefine _globals in if-else loop.
I use _globals new values immediately after the if-else loop is finished (and _globals are defined/redefined) in a function.
Result:
All _globals have value “0”.
Process 2:
I put the _globals to “0” before entering a if-else loop. (same as before)
I redefine _globals in if-else loop. (same as before)
I need to press a button to call the function (same function as before - only difference is that I wait a while).
Result:
All _globals use correct values.
Conclusion:
_globals are not defined properly before code moves on.
Remedy:
Well, with sharedObjects you can use the function “flush” to force the value into the sharedObject immediately.
If there is a similar function for _globals that could solve the problem.
*Originally posted by Danneman * How could I wait for a _global to CHANGE its current value?
just put the global vars into another variable and check to see if it’s the same the next time it loops around:
oldglob = _global; //put this right before you have the global variable change
if (_global != oldglob) {
// do yo thang
} else {
// don't do yo thang
}
Well, what happens then is that the code just passes by without executing. If I put it in a while-sentence (while _global not new value), then the script hangs in an infinite loop.
But I found a workaround to the problem, but since its pretty particular to my code, and is of no real general value, I will not post it.