Loading variables

Im having a big problem…

If i define a variable “temp” in the main timeline and the want to load it with a value from a text file, say data.txt which has the variable &temp =9.

How can i do that??

I want it to be an easy way to tell a movieclip how many times it should duplicate just by alter the data.txt file.

I cant get the value into the variable…
in frame 4 i have…var temp;
and in frame 6 i have loadVariablesNum("./texter/data.txt", 0) but when i use trace(temp) it says undefined and no value…the path is correct cause when i make a dynamictextbox with the variable set to temp, number 9 displays.

But i want to load it iinto the variable temp not the textbox.

You can use the loadVars object to store data from a textfile. Place this on the main timeline, then you can always target the variable on the main timeline by using lv.variable name, so lv.temp for example. If you want to access it anywhere, change lv = new LoadVars() to _global.lv = new LoadVars(); :slight_smile:


lv = new LoadVars();
lv.load("yourtextfile.txt");