# Passing variables between .swf's

**URL:** <https://forum.kirupa.com/t/passing-variables-between-swfs/2650>\
**Category:** Uncategorized\
**Created:** [May 11, 2002, 4:48pm UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650 "2002-05-11T16:48:26Z")\
**Posts on this page:** 6\
**Page:** 1

<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:** [May 11, 2002, 4:48pm UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/1 "2002-05-11T16:48:26Z")

</div>

Hello all, I have a bit of a problem. I’m trying to get one movie to send a variable to another movie. I was hoping someone could show me how to check the string that’s being sent, and have the movie do stuff based on what string is being sent (if (string==“bla”){gotoAndPlay(“bla”);}. Thanks in advance.

---

<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:** [May 15, 2002, 10:19am UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/2 "2002-05-15T10:19:12Z")

</div>

I believe that what you’re trying to achieve is called XML.\rUnfotunately, I’m not at all an expert in this field, but you can try doing something like this:\r\rLink from the origin swf:\rgetURL("\<a href=“[http://www.yoursite.com/name.swf?variable=value");"](http://www.yoursite.com/name.swf?variable=value%22);%22)\>[www.yoursite.com/name.swf...e=value](http://www.yoursite.com/name.swf...e=value)”);\</a\>\r\rI don’t know if that’ll work, because flash files work differently when not embeded into html pages. So your question interests me as well.

---

<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:** [May 15, 2002, 11:50am UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/3 "2002-05-15T11:50:04Z")

</div>

hmm… doesn’t seem like it should be that hard to do… XML shouldn’t be necessary… though I’m not posative off the top of my head. Would both swf’s be open on the same screen of the same computer? If not… like you want two different comps to talk to each other then yeah XML socket is the way to go… if it’s just one movie telling another what to do… that’s a little different.

---

<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:** [May 15, 2002, 3:04pm UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/4 "2002-05-15T15:04:42Z")

</div>

Thanks for the reply. Here’s a more detailed description of th problem:\r\rI have 2 movies, each in a separate frame; ‘left’ and ‘main’. The ‘left’ frame is the navigation console, which is going to update the ‘main’ frame when a user hits a button. For a coulple of the pages I’ve embeded an .swf as the content of ‘main’. I need someway for the nav .swf to communicate with the ‘main’ .swf. I am using an fscommand to JS to pass a variable (myVar) from ‘left’ to ‘main’. Currently, myVar is passed to ‘main’, but I am unable to check the variable. I can only display it in a text box. So I know it’s being passed to the movie, but what I need to do is be able to read the variable, and based on the contents of said variable perform the proper action;if (myVar==“training”){gotoAndStop(“training”);}, or something to that effect.

---

<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:** [May 17, 2002, 6:04pm UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/5 "2002-05-17T18:04:59Z")

</div>

I’m shooting in the dark here, but did you manage to achieve it using this?:\r\rButton Action on nav.swf:\r\ron(Release){\rgetURL(“menu.swf?myVariable=training”);\r}\r\rAccording to what upu said, it should work…

---

<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:** [May 18, 2002, 2:26am UTC](https://forum.kirupa.com/t/passing-variables-between-swfs/2650/6 "2002-05-18T02:26:12Z")

</div>

I think that will work… ?myVariable=something at the end of an address should send that variable along to the swf that you’re loading.
