This content has been marked as final. Show 2 replies
> How can I update a variable from a textfile into a frame?
I think you're asking how to load a variable from a text file, right?
> The hard part is that I want to keep the same variables in
> the textfiles and I want only change the textfile name.
This is the part I don't understand. You cannot change the text file's
name from Flash. You can reference a text file by its current name, and you
can load variables stored in that text file, but that's the extent of it.
> example script on a frame,
> new loadVariablesNum(page);
> page = loadVariablesNum("data/img_autonoom.txt", 0);
Line 1 (with the term "new") is not necessary, here. loadVariablesNum
is not a class or method, it's just a function. There's nothing to
instantiate, such as you would with, say, an Array instance. Just call the
loadVariablesNum() function in a line by itself.
Line 2 acts as if loadVariablesNum() returns a value, but it doesn't.
The variable page will not be updated in this manner. Simply call
loadVariablesNum() and supply a) the path to to your text file and b) the
level into which you'd like to load the variables stored in that text file.
If that text file *contains* a variable named page, then page will become a
variable in level specified, and its value will be the value set for that
variable in the text file. Make sense?
This is all spelled out in detail in the ActionScript 2.0 Language
Reference, by the way. You might also consider using loadVariables() or the
LoadVars class (that one does require the "new" line).
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."
Thanks David! It's makes more sense now. I think I have to study more in ActionScript 2.0 Language...