Hi,
I think its a matter of function scope, but I can’t get my head around it. I’m simply loading an external file with a variable that I want to pass from the loadVars function. It goes something like this.
count.txt - file
nr - the name of the loaded variable that is in the file
working - a dynamic textfield for the working number
notworking - a dynamic textfield in which I get “undefined”
loadVarsNum = new LoadVars();
loadVarsNum.onLoad = function(success) {
if (success) {
trace("loaded");
_root.working.text = this.nr;
} else {
trace("not loaded");
}
};
loadVarsNum.load("count.txt");
_root.notworking.text = nr;
Is it because I need to add “…cess):Number’” and in the function “return nr;” ? Or is it because I don’t have the “nr” variable when I assign it to the second textfield?
Thank you.