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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reading variable from Text file

Status
Not open for further replies.

phishbone

Programmer
Jun 18, 2003
11
CA
Hello,
I am communicating with a database through flash and an asp page. I query the database and output a variable to a text file. For some reason I CANNOT read the variable from the text file. I've done this before and it has worked fine, but I'm not getting anything now. The text file reads "energy=5000", but the energy variable in flash does not get set to this value.

I am trying to use

loadVariablesNum ("C:\energy.txt", 0);

if I use
loadVariablesNum ("energy.txt", 0);
I get
Error opening URL "file:///C|/Inetpub/Why does it add all that stuff to the path? Which way should the slashes go?

please help!
How do I do this properly? I've made sure that there the text files are there and they are not Read Only.

Thanks,
Emily
 
Why not simply have the text file in the same folder as your Flash movie?

loadVariablesNum("energy.txt", 0);
 
I have tried that, but I still can't get it to read the variable. If you read my post again you will see what happens when I put

loadVariablesNum("energy.txt", 0);

i get the error
Error opening URL "file:///C|/Inetpub/
 
Just in case...

does your text file look like this?

energy=5000&

The ampersand signifies the end of the file/variable. Don't know if this will make any difference.

There's always a better way. The fun is trying to find it!
 
Naaaaah! That wouldn't generate that error message, which simply says that the text file can't be found through that path & folders.
Are you sure of the exact same spelling in the text file's name? No caps in one case, and not in the other? Is the extension the exact same?
 
Okay, I'm not usually this slow on the uptake. Any after re-reading all the posts, this is what I see:

this: loadVariablesNum ("C:\energy.txt", 0);

says that energy.txt is in the root of C drive, not in C:/inetpub/
and when you do this: loadVariablesNum ("energy.txt", 0);

the error message tells you that the file IS NOT in C:/inetpub/
So.... exactly where is energy.txt? In C: or in C:/inetpub/
There's always a better way. The fun is trying to find it!
 
Is this for local use only?
If so and if "energy.txt" is in c: , then the line should be...

loadVariablesNum("file://c:/energy.txt", 0);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top