Skip to main content
Known Participant
August 10, 2006
Question

update variable from a textfile?

  • August 10, 2006
  • 2 replies
  • 283 views
How can I update a variable from a textfile into a frame? The hard part is that I want to keep the same variables in the textfiles and I want only change the textfile name.

example script on a frame,

new loadVariablesNum(page);
page = loadVariablesNum("data/img_autonoom.txt", 0);

variable example is from a textfile is &link1, &link2 and that I will use for my movieclips as _root.link1 _root.link2 etc.

already thanks for your time!
This topic has been closed for replies.

2 replies

vinnioAuthor
Known Participant
August 10, 2006
Thanks David! It's makes more sense now. I think I have to study more in ActionScript 2.0 Language...
Inspiring
August 10, 2006
vinnio,

> 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).


David Stiller
Adobe Community Expert
Dev blog, http://www.quip.net/blog/
"Luck is the residue of good design."