waffe
February 9, 2003, 12:55am
1
When I was working with a txt file locally I used this command
file = new LoadVars();
fileURL = “PhoneBook.txt”;
file.load(fileURL);
But now I am posting this file to a server so the code changes to
file = new LoadVars();
fileURL = (“PhoneBook.php?Ran=”+random(999), 0);
fileURL = “PhoneBook.txt”;
This does not work; flash does not see the txt file.
Flash does see the file online when I use
loadVariablesNum (“PhoneBook.txt?Ran=”+random(999), 0);
But I would rather use LoadVars.
Any suggestions.
system
February 9, 2003, 3:26am
2
Why do you have 2 fileURL variables doing two different things?
system
February 9, 2003, 3:56am
3
Funny you ask. This code is from h88. It comes from a project I did a few months back and h88 helped me with it. In fact you did too, but not with this part.
If I take out any part of this code my project will not work. So I believe I have to have file.load(fileURL). This is what you load into loadVares. What you put into loadVars is the file(URL), which is the TEXT file.
So, I do not believe they are doing two differnt things.
:geek:
system
February 9, 2003, 4:02am
4
file = new LoadVars();
fileURL = (“PhoneBook.php?Ran=”+random(999), 0);
fileURL = “PhoneBook.txt”;
Ok, well that looks a bit off to me. As I believe I stated before to you, I am not good with server-side Flash… but I will give it a shot…
Try this…
fileURL = "PhoneBook.php?Ran="+random(999);
file = new LoadVars();
file.onLoad = function(success) {
if (success) {
//do this
} else {
trace("File Load Failed");
}
};
file.load(fileURL);
system
February 9, 2003, 11:44pm
5
I must of been doing something else wrong because I got it to work. The code;
file = new LoadVars();
fileURL = (“PhoneBook.php?Ran=”+random(999), 0);
fileURL = “PhoneBook.txt”;
works just fine, thanks for your time.
system
February 9, 2003, 11:48pm
6
Congrats on getting it to work
system
February 11, 2003, 2:53pm
7
???
I can’t believe that this code is what your using to post to the php file!!!
file = new LoadVars();
fileURL = ("PhoneBook.php?Ran="+random(999), 0);
fileURL = "PhoneBook.txt";
Looks weired tho. Anyways, when you try to post to a file through flash, you should use ‘send’!
myLoadVars = new LoadVars();
myLoadVars.send(“PhoneBook.php?Ran=”+new Date().getTime(), 0, “POST”);
Notice that using ‘0’ as the target WILL only post _root variables.
system
February 12, 2003, 12:25am
8
You are right h88 that is not the right code. It should look like this:
file = new LoadVars();
fileURL = “PhoneBook.txt”;
file.load(fileURL);
Don’t know how I messed that up; you can see in my first post I have it written correctly.
And thanks for the “send” info, I will try it out.