# loadVariablesNum to LoadVars

**URL:** <https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107>\
**Category:** flash\
**Created:** [February 9, 2003, 12:55am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107 "2003-02-09T00:55:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)\
**Post date:** [February 9, 2003, 12:55am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/1 "2003-02-09T00:55:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2003, 3:26am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/2 "2003-02-09T03:26:01Z")

</div>

Why do you have 2 fileURL variables doing two different things?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2003, 3:56am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/3 "2003-02-09T03:56:26Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2003, 4:02am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/4 "2003-02-09T04:02:42Z")

</div>

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…

```php
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);

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2003, 11:44pm UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/5 "2003-02-09T23:44:05Z")

</div>

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.

😊

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 9, 2003, 11:48pm UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/6 "2003-02-09T23:48:54Z")

</div>

Congrats on getting it to work 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 11, 2003, 2:53pm UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/7 "2003-02-11T14:53:37Z")

</div>

???

I can’t believe that this code is what your using to post to the php file!!!

```php
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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 12, 2003, 12:25am UTC](https://forum.kirupa.com/t/loadvariablesnum-to-loadvars/13107/8 "2003-02-12T00:25:54Z")

</div>

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.
