# loadVariables using variable instead of url?

**URL:** https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922
**Category:** flash
**Created:** [November 7, 2003, 10:11pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922 "2003-11-07T22:11:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![warped](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@warped](https://forum.kirupa.com/u/warped)
#### Post date: [November 7, 2003, 10:11pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/1 "2003-11-07T22:11:04Z")

</div>

Just wondering if it was possible to set the url in a variable name in the event that you wanted different files loaded into the same text field, like:

url=‘myUrl.txt’;  
loadVariables(myUrl,0);

Did a search for this information but came up with nothing.

---

<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: [November 7, 2003, 11:09pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/2 "2003-11-07T23:09:40Z")

</div>

So you’re saying that you want the variables to load from a different file using the dynamic textboxes URL link and not actionscript? Well, I think that can be done using **asfunction**. Do a search on that, type in **loadVariablesNum using asfunction**. 🙂

---

<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: [November 7, 2003, 11:22pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/3 "2003-11-07T23:22:09Z")

</div>

What I want is to be able to load using LoadVariables, but instead of providing the exact url I want it to check a variable for the url, is that possible?

---

<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: [November 7, 2003, 11:34pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/4 "2003-11-07T23:34:54Z")

</div>

Oh ok. So what you want to do is: Using ActionScript: Search for a Variable in the movie: That has the name of the URL: Take that name: And use that name to load. Here’s what you wanna do:[list=1]  
[_]Make a variable called **URL**. Inside it, type in the url that links to the text file.  
[_]Make another variable called **display**. Inside it will be what is loaded.  
[_]Make a text document and put: **display=Hello**.  
[_]For the actionscript, put in first frame:

```auto
loadVariablesNum(URL, 0);

```

[/list]  
This code makes it get what the URL is from a variable. Then using that URL, it goes to the URL, reads what will be displayed in the **display** variable, and shows that text in flash!

- Hope I helped. 🥚

---

<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: [November 7, 2003, 11:51pm UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/5 "2003-11-07T23:51:22Z")

</div>

Actually, I think he wants to set up an input box so one can type in the url, then have LoadVariables pull in a text file and toss it into a dynamic text box. At least I think, I’m not sure. If so, yes you can, but your first post’s code is wrong:

```auto

url='myUrl.txt';
loadVariables(myUrl,0);
//should be
url='myUrl.txt';
loadVariables(url, 0);

```

But if that’s what you’re doing, I would do this:

```auto

url = 'myUrl.txt';
lv = new LoadVars();
lv.onLoad = function (success){
if (success){
textboxname.text = this.display;
}
}
lv.load(url);

```

Then, as Sharif said, make a text file that has this in it:

```php

display = all the stuff you want to have appear in the textbox

```

---

<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: [November 8, 2003, 12:35am UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/6 "2003-11-08T00:35:55Z")

</div>

Awesome, loadVars fixed my problems - Thanks.

---

<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: [November 8, 2003, 12:45am UTC](https://forum.kirupa.com/t/loadvariables-using-variable-instead-of-url/34922/7 "2003-11-08T00:45:46Z")

</div>

\*\*\*\* it thunder! This means war!

- BTW, My code did work fine, but I didn’t understand that he wanted me to type something in.
