# Loading text into a swf into anonther swf

**URL:** <https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195>\
**Category:** Uncategorized\
**Created:** [July 6, 2004, 12:09pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195 "2004-07-06T12:09:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Axios](https://avatars.discourse-cdn.com/v4/letter/a/22d042/32.png) [@Axios](https://forum.kirupa.com/u/Axios)\
**Post date:** [July 6, 2004, 12:09pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/1 "2004-07-06T12:09:03Z")

</div>

Hiya!

Hope you can help me! This is driving me nuts! I have a swf with a dynamic text box (which is inside a movieclip) which loads text from a .txt file. This swf is then loaded into a blank mc (main) in another swf.

The text appears if I view the child, but in the parent, the child swf appears but not the text. I have tried nearly every combintation of actionscript to get it to load!! Please help!! My code is as follows…

In the parent swf…

```auto
_root.main.loadMovie("welcome.swf")

```

In the child swf…

```auto
loadVariables("axiostext.txt", "box");

```

The text has a variable name of welcometext. Please help!!

Thanks :o)

---

<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 7, 2004, 3:42am UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/2 "2004-07-07T03:42:00Z")

</div>

why don’t you load the text through the parent, and send it to the child after its a variable:

```auto

//load stuff
_root.child.welcometext = welcometext

```

If that makes sense.

---

<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 7, 2004, 11:27am UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/3 "2004-07-07T11:27:49Z")

</div>

Thats not working either. The text loads fine whether I load it into the parent or the child, as I did a test to make sure. It just doesnt seem to want to send it to the child swfs textbox once you play the main movie. Im nearly tearing my hair out here!! Please someone help!!!

:crying: :crying:

---

<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 7, 2004, 2:27pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/4 "2004-07-07T14:27:00Z")

</div>

does the text box refer to a variable on the roo(\_root.variable). because if its a child movie clip (even if it was loaded), the \_root.variable refers to the timeline of the parent, not the child.

---

<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 7, 2004, 2:45pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/5 "2004-07-07T14:45:44Z")

</div>

No, I have changed my code where it says \_root and replaced it with this. or \_parent. as from what Ive read on these problems, that is better coding.

I also found tutorials on using LoadVars which works fine in a swf, it also works fine if you load the swf into another swf. But when I load it into a blank movieclip in a swf the text disapears again.

But even the easy way I was doing it before seems to work, until I try to target the text box in the blank mc.

Any ideas?

i really appreciate your help!!!

Cheers, Jen :}

---

<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 7, 2004, 2:51pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/6 "2004-07-07T14:51:04Z")

</div>

hmmmm… I think I might know, because loading a variable is an asycronous action you may be trying to send the variable to the child before it exists. So try this:

```auto

loader = new LoadVars(); //create the loadvars object
loader.load("text_file_here.txt"); //this can be any type of file that returns text (IE: PHP, ASP etc)
loader.onLoad = function(success) {
	if(!success) { //tests the success variable to ensure it loaded
		this.welcometext = "Error"; //makes the variable an error if it didn't load the variable
	}
	_root.child.welcometext = this.welcometext; //send the variable to the child
}

```

I hope that works for you.

---

<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 7, 2004, 3:49pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/7 "2004-07-07T15:49:39Z")

</div>

jerez\_z :hugegrin: You are an absolute 👼

Thank you thank you thank you thank you thank you!!!

I may be back with more questions before I finish this project! (But hopefully not!!!)

Thanks again! Jen :}

---

<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 7, 2004, 3:51pm UTC](https://forum.kirupa.com/t/loading-text-into-a-swf-into-anonther-swf/115195/8 "2004-07-07T15:51:47Z")

</div>

glad to be of help 😃
