# MX loading external .txt files

**URL:** <https://forum.kirupa.com/t/mx-loading-external-txt-files/10412>\
**Category:** flash\
**Created:** [December 31, 2002, 4:16pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412 "2002-12-31T16:16:16Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pjc4real](https://avatars.discourse-cdn.com/v4/letter/p/58f4c7/32.png) [@Pjc4real](https://forum.kirupa.com/u/Pjc4real)\
**Post date:** [December 31, 2002, 4:16pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/1 "2002-12-31T16:16:16Z")

</div>

Hey guys.

Ive got a prob.

When I click on a button eg news, I use the loadmovie function to load news.swf. In news.swf, I have the following command (from Kirupa scrolling dynamically loaded text tut) to load a text file in:

stop();  
loadText = new loadVars();  
loadText.load(“news.txt”);  
//creating the loadVarsText function  
loadText.onLoad = function() {  
scroller.text = this.newstext;  
};

This works FINE locally (on my HD0, but when I upload, the text isn’t loaded!!

I’ve tried using absolute location - (“[http://www.decyfa.netfirms.com/news.txt](http://www.decyfa.netfirms.com/news.txt)”) but that doesn’t work either! Ne ideas??

---

<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:** [December 31, 2002, 6:18pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/2 "2002-12-31T18:18:38Z")

</div>

I’m not 100% sure, but I think the problem is that on your HDD, the file loads up really fast (it’s loaded even before the onLoad function is declared). I think if you put the onLoad definition in a frame loop and have the loop stop when the file is loaded, then it will work on the server. Something like this:

Frame 1:

```php

loadText = new loadVars();
loadText.load("news.txt");
//creating the loadVarsText function

```

Frame 2:

```php

loadText.onLoad = function() {
scroller.text = this.newstext;
};

```

Frame 3:

```php

gotoAndPlay(2);

```

Like I said I’m not 100% sure about this but it’s worth a shot. And I know it’s not a very elegant solution. 🙂

-Al

---

<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:** [December 31, 2002, 6:22pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/3 "2002-12-31T18:22:48Z")

</div>

Ok - thanx mate! im just gonna try it and see wot happens…C:-)

---

<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:** [December 31, 2002, 7:08pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/4 "2002-12-31T19:08:27Z")

</div>

Thnx… but it stil duznt seem to be wrking. I tried anutha method found on Macromedia’s site, which again wrkd fine locally, but didnt when I uploaded. Nemore 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:** [December 31, 2002, 7:29pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/5 "2002-12-31T19:29:41Z")

</div>

Can u post your FLA and TXT files?

---

<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:** [December 31, 2002, 8:38pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/6 "2002-12-31T20:38:44Z")

</div>

Ok - here goez!!

---

<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:** [December 31, 2002, 8:44pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/7 "2002-12-31T20:44:25Z")

</div>

Sorry -I’ve never attached before!

I’ll upload them to my server…

[www.decyfa.netfirms.com/My-files.zip](http://www.decyfa.netfirms.com/My-files.zip)

Right click and save As…!

---

<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:** [December 31, 2002, 8:50pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/8 "2002-12-31T20:50:46Z")

</div>

Strange…all I see are stop(); actions…nothing more. Any idea why?

---

<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:** [December 31, 2002, 8:56pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/9 "2002-12-31T20:56:30Z")

</div>

Oh sorrry!!! Ok, when u open home.fla, u hav three layers right? (actions, content, bg).

On the **content** layer, double click the movie clip (the fisrts frame is “empty” so on the stage all u will see is a white circle). Once u are in that movieclip (called **boxDrop** ),the actions are at the end of the timeline on the **actions** layer.

Thnx!

---

<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:** [December 31, 2002, 9:08pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/10 "2002-12-31T21:08:11Z")

</div>

Ok thnx! R u going to send it bak via email?

---

<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:** [December 31, 2002, 9:08pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/11 "2002-12-31T21:08:45Z")

</div>

Ok…I haven’t tried this on a server (I don’t have one), but I think it should work. I just editted the actions layer in that MC that sits on the root content layer.

-Al

::EDIT:: darn, can’t attach it…too big. ok, here’s the AS:

In frame 26:

```php

loadVarsText = new loadVars();
loadVarsText.onLoad = function(success) {
	if (success) {
		trace("done loading");
		scroller.text = this.hometext;
	} else {
		trace("not loaded");
	}
};

```

and in Frame 27:

```php

loadVarsText.load("home.txt");
stop();

```

Hope it worx.

---

<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:** [December 31, 2002, 9:16pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/12 "2002-12-31T21:16:45Z")

</div>

I am SO stumped… IT’s STILL NOT WORKING!!! Thnx for trying, but it still doesnt want to load the text file!!! Check it out at [www.decyfa.netfirms.com](http://www.decyfa.netfirms.com) to see wot I mean!

:q: ☹

---

<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:** [December 31, 2002, 11:26pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/13 "2002-12-31T23:26:55Z")

</div>

Hmm…I have no clue why it isn’t working…sorry. I’ll see if I can figure it out, though. And I’ll let you know.

---

<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:** [January 1, 2003, 12:20am UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/14 "2003-01-01T00:20:33Z")

</div>

Ok my last suggestion:

instead of:  
trace(“not loaded”);

try:  
scroller.text= “not loaded”;

That way you will see if the onLoad method is even running properly. Also, I uploaded it to my hosting (i just set it up) and it works fine…

-Al

---

<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:** [January 1, 2003, 4:02pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/15 "2003-01-01T16:02:32Z")

</div>

Sorry - just got ur reply!

SO my code on frame 26 should look like the following:

loadVarsText = new loadVars();  
loadVarsText.onLoad = function(success) {  
if (success) {  
trace(“done loading”);  
scroller.text = this.hometext;  
} else {  
scroller.text= “not loaded”;  
}  
};

---

<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:** [January 1, 2003, 4:08pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/16 "2003-01-01T16:08:22Z")

</div>

I’ve sussed it… but I am SUCH A HALF-WIT!!!

I WAS UPLOAIDNG TO A FREE SERVER, ADN I HAD A SUDDEN IDEA WHEN U SED THAT IT WORKED FINE ON UR SERVER, THAT IT WAS MY SERVER!!!:crazy: :crazy: :crazy:

Ur code worked FINE when I uploaded to my host, its just that I was uploading to a server which doesnt seemt o support it - probably because its free!!!

Thanx again mate!!!

---

<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:** [January 1, 2003, 4:09pm UTC](https://forum.kirupa.com/t/mx-loading-external-txt-files/10412/17 "2003-01-01T16:09:26Z")

</div>

LOL!

I hate it when it’s such a simple thing. 🙂

-Al
