PDA

View Full Version : Please help with txt file variables


archevial
07-31-2001, 11:43 PM
This seems to be such an easy task but i'm under the gun and need some help...

How would I format a text file to pass a variable and a string associated with the variable and what would be the actionscript to retrieve the variables/strings?

example:(text file)

Dallas, Sunny
New York, Rainy
New Jersey, Cloudy

I want to have a text input field that a user can type in a city and the loaded variables from the text file will determine what a variable displays on the next frame...

Example: user submits: dallas
flash displays: sunny

Jesse
08-01-2001, 06:25 AM
file: info.txt:
Dallas=Sunny&NewYork=Rainy&NewJersey=Cloudy
save that info into a text file called info,txt then in flash use:
loadVariablesNum("info.txt",0);
Then have an input text field whose variable is 'place' and a dynamic field whose variable is 'result' and use this code on a button.
on (release) {
result = eval(place)
}
Note you can't have spaces in the place names because they are variables.