Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Confused Over loadVariablesNum() 1

Status
Not open for further replies.

Kijori

Technical User
Jan 22, 2002
67
SG
don't seem to be able to display external variables in textfield. here's my problem...

in main timeline, i've got a movie clip (myMovieClip) which contains a dynamic textfield (myTextfield). the dynamic textfield has a variable named myText. in the main timeline, i have this script;

Code:
loadVariablesNum("../Docs/Example.txt", 0);

inside Example.txt is the line;

myText=Greetings

when i run the movie, nothing is displayed in the textfield. should i move the script to the myMovieClip timeline? what's wrong here?
 
Since you're loading your variables on the main timeline (_level0), simply reference your variable in your textfield's VAR box to the main timeline , by adding _level0 to your variable. Thus make it _level0.myText rather than myText alone. Should work fine in any textfield, nested in whatever number of clips.

Regards. Affiliate Program - Web Hosting - Web Design
 
hey thanks oldnewbie!

by the way, care to explain the purpose of _level0 thingy? what specifically does it do?
 
I did somewhat explain it... Since you're loading the variables on the main timeline (_root or _level0), with

loadVariablesNum("../Docs/Example.txt", 0);

The zero in the above tells Flash to load the variables on _level0. So when setting a variable's name in a textfield, where do you want it to find it's value? Where it was loaded of course, thus on _level0, thus you would add _level0 to your variables to indicate where the variables where loaded!

Regards. Affiliate Program - Web Hosting - Web Design
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top