Hi, I’m trying to set a global var within a LoadVars function and have it keep that value globally. In the following example, I define logStatus as a global variable and set it to “banana”, then within a function I set it to “orange”, then later outside the function its value is banana again. Why isn’t the global working here?
_global.logStatus = “banana”;
var getUser_lv:LoadVars = new LoadVars();
getUser_lv.load(“mypath.php”);
getUser_lv.onLoad = function(success:Boolean){
if(success){
logStatus = “orange”;
trace("logStatus in function is: "+logStatus);
}else{
logStatus = "apple";
trace("logStatus in function is: "+logStatus);
}
}
trace("logStatus after function is: "+logStatus);
The above example gives the following trace output:
logStatus after function is: banana
logStatus in function is: orange
You help would be appreciated.
Thanks
Quarky