# Passing a string to an external MC

**URL:** https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121
**Category:** Uncategorized
**Created:** [July 4, 2008, 7:17am UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121 "2008-07-04T07:17:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Alber\_Kidd](https://avatars.discourse-cdn.com/v4/letter/a/e47c2d/32.png) [@Alber\_Kidd](https://forum.kirupa.com/u/Alber_Kidd)
#### Post date: [July 4, 2008, 7:17am UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121/1 "2008-07-04T07:17:51Z")

</div>

I load my external swf…

var myRequest1:URLRequest = new URLRequest(“external.swf”);  
myLoader1.load(myRequest1);  
var \_content:MovieClip = MovieClip(myLoader1.content);  
stage.addChild(\_content);  
\_content.myname =“Albert”;

on the first frame of the external swf

trace(“hello you” + myname);

I get an error. How Do I do this?

Thanks

---

<div class="post-metadata">

### Author: ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)
#### Post date: [July 4, 2008, 10:41am UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121/2 "2008-07-04T10:41:25Z")

</div>

made it and zip it, check for the files and tell if there’s something you can’t understand.  
mainly you have to create a class to hold the value.

🙂

don’t know if there is another way to do this, as I don’t see any global vars is AS3.

---

<div class="post-metadata">

### Author: ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)
#### Post date: [July 4, 2008, 11:34am UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121/3 "2008-07-04T11:34:51Z")

</div>

because your code is just plane wrong

> var \_content:MovieClip = MovieClip(myLoader1.content);  
> stage.addChild(\_content);  
> \_content.myname =“Albert”;

you need to set up a variable, then the swf read that variable

---

<div class="post-metadata">

### Author: ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)
#### Post date: [July 4, 2008, 4:12pm UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121/4 "2008-07-04T16:12:06Z")

</div>

> you need to set up a variable, then the swf read that variable

hi randomagain, how would you do that?

---

<div class="post-metadata">

### Author: ![TheGoods](https://avatars.discourse-cdn.com/v4/letter/t/a587f6/32.png) [@TheGoods](https://forum.kirupa.com/u/TheGoods)
#### Post date: [July 4, 2008, 6:46pm UTC](https://forum.kirupa.com/t/passing-a-string-to-an-external-mc/265121/5 "2008-07-04T18:46:48Z")

</div>

I think he meant declare a variable in the external swf thats going be loaded.  
Make a var myname:String in the external swf.

I think your problem though is that you need to sell the value into the swf after its completely loaded. You should have a onComplete handler, after the swf is fullly loaded. To send the variable
