# Passing a variable

**URL:** <https://forum.kirupa.com/t/passing-a-variable/12116>\
**Category:** flash\
**Created:** [January 27, 2003, 7:06am UTC](https://forum.kirupa.com/t/passing-a-variable/12116 "2003-01-27T07:06:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![reverendflash](https://avatars.discourse-cdn.com/v4/letter/r/f08c70/32.png) [@reverendflash](https://forum.kirupa.com/u/reverendflash)\
**Post date:** [January 27, 2003, 7:06am UTC](https://forum.kirupa.com/t/passing-a-variable/12116/1 "2003-01-27T07:06:09Z")

</div>

Learning MX syntax… coming along fine until:

I have an swf setting a variable in one level, and I want to be able to include that variable as the target for my loadmovie to load into…

I’ve set the variable in \_level15 (name of the target), and I want to load 1.jpeg into that target (variable set in \_level15) which is in \_level40…

How do I pass it to level40?

Rev ![](http://www.aulman.com/rev.gif)

---

<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 27, 2003, 7:19am UTC](https://forum.kirupa.com/t/passing-a-variable/12116/2 "2003-01-27T07:19:33Z")

</div>

If I am not mistaken… it should be…

loadMovieNum(String(\_level15.yourVariable), 40);

I don’t know if you can do it with numbers, so if that doesn’t work, try

loadMovieNum(String(\_level15.yourVariable+“b”), 40);

So it will be 1b instead of 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:** [January 27, 2003, 7:34am UTC](https://forum.kirupa.com/t/passing-a-variable/12116/3 "2003-01-27T07:34:40Z")

</div>

okay, I tried to make that work, and got nowhere. Let’s try this attack:

Here is the code I would use, if i weren’t trying to pick up a variable:

on (release) {  
loadMovie("…/dodge/aarp1.jpg", \_root.\_level40.panel1);  
}

panel1 being the target. I have it so a button on level 15 is setting the variable named panel to “panel1.” I have a text field letting me know the variable is set.

how would I alter the above code to include the variable \<i\>panel\</i\> ?

thanks for the help,

Rev ![](http://www.aulman.com/rev.gif)

---

<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 27, 2003, 7:40am UTC](https://forum.kirupa.com/t/passing-a-variable/12116/4 "2003-01-27T07:40:42Z")

</div>

on (release) {  
loadMovie("…/dodge/aarp1.jpg", \_root.\_level40.panel1);  
}

Ok, I don’t have flash open, which isn’t good, but I will give it a shot.

on(release){  
loadMovie(String(\_level15.panel), \_level40.panel1);  
}

And as stated before, perhaps calling a variable as a number is the problem so you might want to try adding a letter or something and changing the clip name like this…

on(release){  
loadMovie(String(\_level15.panel+“b.jpg”), \_level40.panel1);  
}

Also… I believe Flash can only load .jpg not .jpeg. I forget where I read it, but I remember reading that .jpeg files won’t load in Flash. That “e” makes all the difference.

Or maybe I am hallucinating :-\
