PDA

View Full Version : FMX:Loading External variable from text into variable



borispc
September 8th, 2003, 02:13 PM
Hi!
Here's the deal: I want to load an external variable called name from a text file into a local variable in flash called my_str...here's what I have:

var loadText = new loadVars();
loadText.onLoad = function(success) {
if (success) {
myVar = this.name;
_root.my_str = myVar;
//if I trace(_root.my_str) here I get the external text fine
} else {
trace("Error loading data");
}
}
loadText.load("data.txt");
//tracing (_root.my_str) here returns undefined

I need to have the variable my_str available outside the function...any ideas why it isn't working???
thanx.

Voetsjoeba
September 8th, 2003, 02:23 PM
loadText.name ;)

borispc
September 8th, 2003, 02:30 PM
thanx ;)

Voetsjoeba
September 8th, 2003, 02:36 PM
You're welcome :)