borispc
August 6th, 2003, 08:30 PM
Hi! :hat:
I don't know why the value of my variable my_str is undefined outside of this function:
loadText = new loadVars();
loadText.load("data.txt");
loadText.onLoad = function(success) {
if (success) {
my_str = this.name;
trace(my_str)//my_str has the right value
} else {
trace("Error loading data");
}
}
trace(my_str)//my_str is undefined
ps: I tried making my_str a global function or even defining it as _root.my_str but I always get the same result..it's undefined outside the function...I need that value for something else so...
anyone has a clue???
I don't know why the value of my variable my_str is undefined outside of this function:
loadText = new loadVars();
loadText.load("data.txt");
loadText.onLoad = function(success) {
if (success) {
my_str = this.name;
trace(my_str)//my_str has the right value
} else {
trace("Error loading data");
}
}
trace(my_str)//my_str is undefined
ps: I tried making my_str a global function or even defining it as _root.my_str but I always get the same result..it's undefined outside the function...I need that value for something else so...
anyone has a clue???