# Problem with loading external files

**URL:** https://forum.kirupa.com/t/problem-with-loading-external-files/57001
**Category:** flash
**Created:** [July 9, 2004, 2:04pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001 "2004-07-09T14:04:26Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Mango](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Mango](https://forum.kirupa.com/u/Mango)
#### Post date: [July 9, 2004, 2:04pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/1 "2004-07-09T14:04:26Z")

</div>

Hello there.

I have a main template swf file, and within this another swf file which contains everything else. I used the loadVariables action to load an external data file (which contains HTML) into a textfield, and when checking to see if this works it loads up fine. However when i test the outer swf file, this does not come up at all.  
I tried putting the full path to the file (I’m currently working offline, so the path is to a file on the computer). I don’t know how else i can fix this. I would be grateful if someone could help me on this problem please!

Thanks in advance :te:

---

<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: [July 9, 2004, 5:03pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/2 "2004-07-09T17:03:20Z")

</div>

Can you show us the whole code?

---

<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: [July 9, 2004, 5:12pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/3 "2004-07-09T17:12:03Z")

</div>

ok well… on the layer with the textfield, i have this:

```auto
loadVariablesNum("C:/xxx/xxxxx/main.txt", 0);

```

then in a later frame i have this:

```auto
contentArea.htmlText = text;
stop();

```

---

<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: [July 9, 2004, 5:13pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/4 "2004-07-09T17:13:15Z")

</div>

Hmm - so you’re telling me that it works in it’s own swf. But when you load this swf into the main one, it doesn’t?

---

<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: [July 9, 2004, 5:26pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/5 "2004-07-09T17:26:36Z")

</div>

yup thats right.  
☹

---

<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: [July 9, 2004, 5:29pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/6 "2004-07-09T17:29:15Z")

</div>

Try this:

```auto
_parent.loadVariablesNum("C:/xxx/xxxxx/main.txt", 0);

```

Don’t know if this will work but it certainly helped me fix my preloader in the old days :P. Try changing it to \_root. if it doesn’t work.

If none of this works - maybe you have to convert the textbox into a movieclip and then tell the load code to specifically load it INTO the movieclip.

–

Addition: On the main swf, **on the frame** that loads the second swf, you can add that load code instead of on the inside of it. This is another method. But it’s complicated. Try what I said up there first.

---

<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: [July 9, 2004, 5:46pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/7 "2004-07-09T17:46:53Z")

</div>

I just tried \_parent and \_root, it doesn’t work ☹  
Thanks though.

---

<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: [July 9, 2004, 5:49pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/8 "2004-07-09T17:49:22Z")

</div>

If it still doesn’t work - it might be your dynamic text html activate code.

Try some different stuff like variable. Is contentArea the instance name of the dynamic box or is it the var?

–

Are you trying to LOAD html INSIDE the box to show people the html or something?

---

<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: [July 9, 2004, 6:29pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/9 "2004-07-09T18:29:54Z")

</div>

Ah right ok.  
contentArea is the name of the box. I just wanted to load some information, not html.

---

<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: [July 9, 2004, 6:35pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/10 "2004-07-09T18:35:09Z")

</div>

Ok - if contentArea is the instance name, make sure you give it a variable too. Let’s give it the variable **myContent**.

Then, change your load code to:

```auto
loadText = new LoadVars();
loadText.load("HTML.txt");
loadText.onLoad = function() {
	contentArea.text = this.myContent;
};

```

---

<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: [July 10, 2004, 10:09am UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/11 "2004-07-10T10:09:29Z")

</div>

Thanks for the help Reefster. I tried using the code you posted up, but it didnt seem to work. Now i finally have it working 🙂

The code i used instead: (used one of the tutorials - why didn’t i do this in the first place?? O\_o)

```auto
loadText = new loadVars();
    loadText.load(".../main.txt");
    loadText.onLoad = function(success) {
        if (success) {
            // trace(success);
            contentArea.html = true;
            contentArea.htmlText = this.text;
        }
    };
	stop();

```

---

<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: [July 10, 2004, 5:41pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/12 "2004-07-10T17:41:08Z")

</div>

What?

That’s like the exact code I gave you, all you had to do is add the htmlText part…aw I feel like waste…

---

<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: [July 11, 2004, 9:45am UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/13 "2004-07-11T09:45:13Z")

</div>

oops sorry ☹ for some reason it didn’t work though. maybe cos you told me to add a variable name to it as well :\*(

```auto
contentArea.text = this.myContent;

```

there was this bit also that took the text from the file im assuming, and putting it into the dynamic box. But i tried this and it didn’t work at all for some reason :-/

---

<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: [July 11, 2004, 5:12pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/14 "2004-07-11T17:12:55Z")

</div>

No problem :)! I’m glad we both know the solution now ;).

---

<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: [July 14, 2004, 3:46pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/15 "2004-07-14T15:46:35Z")

</div>

🙂  
Ok now that problem has been fixed… another one. Lol.  
I want to be able to load different external text files when a user clicks on the buttons, how do i go about that? cos it doesn’t seem to be working :S  
Is there a specific way in which i should do this? eg. all different data on the same scene, or in separate scenes?

---

<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: [July 14, 2004, 3:49pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/16 "2004-07-14T15:49:01Z")

</div>

Depends on where you load them into.

---

<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: [July 14, 2004, 3:53pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/17 "2004-07-14T15:53:20Z")

</div>

they are all going to be loaded into the same dynamic text box. Sort of like having an iframe i guess, when you click on a link it takes you to some different content

---

<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: [July 14, 2004, 3:56pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/18 "2004-07-14T15:56:44Z")

</div>

Just add the loading code for each button and assign it to load into the dynamic textbox, this should be simple. It should just automatically change the text once you press the button.

---

<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: [July 14, 2004, 3:57pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/19 "2004-07-14T15:57:51Z")

</div>

oh right ok. i’ll try that then. I was thinking too much, frame labels etc … lol. I’ll let you know if it works!

---

<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: [July 14, 2004, 3:59pm UTC](https://forum.kirupa.com/t/problem-with-loading-external-files/57001/20 "2004-07-14T15:59:16Z")

</div>

Lol Okay get back to me :P.

[Next page](https://forum.kirupa.com/t/problem-with-loading-external-files/57001.md?page=2)
