Problem with loading external files

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:

Can you show us the whole code?

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

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

then in a later frame i have this:

contentArea.htmlText = text;

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?

yup thats right.

Try this:

_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.

I just tried _parent and _root, it doesn’t work :frowning:
Thanks though.

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?

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

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:

loadText = new LoadVars();
loadText.onLoad = function() {
	contentArea.text = this.myContent;

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 :slight_smile:

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

loadText = new loadVars();
    loadText.onLoad = function(success) {
        if (success) {
            // trace(success);
            contentArea.html = true;
            contentArea.htmlText = this.text;


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

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

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 :-/

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

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?

Depends on where you load them into.

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

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.

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!

Lol Okay get back to me :P.