# \[MX\] how to pick up a variable

**URL:** https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162
**Category:** flash
**Created:** [January 27, 2003, 7:36pm UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162 "2003-01-27T19:36:40Z")
**Posts on this page:** 9
**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:36pm UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/1 "2003-01-27T19:36:40Z")

</div>

Again, I know how to do this in Generator, but I am trying to learn MX syntax.

I have a button in \_level15 setting a variable (panel). I have a button loading a jpg, through loadmove, into a target. The variable is the name of that target.

If I don’t use the variable, here is the code I use:

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

what I want to do, is replace panel1 with the variable named “panel” .

how do I write the syntax?

Thanks in advance for your 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 28, 2003, 2:09am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/2 "2003-01-28T02:09:01Z")

</div>

I think this thread is what you need Rev, if not, please describe more.

[http://www.kirupaforum.com/showthread.php?s=&threadid=12082](http://www.kirupaforum.com/showthread.php?s=&threadid=12082)

---

<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 28, 2003, 2:38am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/3 "2003-01-28T02:38:57Z")

</div>

h88:

It very well could be, but I’m not understanding it. Lost tried to help last nite, but I wasn’t following him at all either…

I have several buttons which will each set a diff value for the variable “panel”…

then, when loading a jpg from a menu, that variable will “tell” the loadmovie which target to load into.

I have got it to work without the variable in the code (if I hard code the target), but I don’t know how to get the variable which was set by another swf, and use that as the target…

thanks,

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 28, 2003, 3:07am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/4 "2003-01-28T03:07:12Z")

</div>

> \*Originally posted by reverendflash \*  
> \*\*but I don’t know how to get the variable which was set by another swf, and use that as the target…[/IMG] \*\*

So your trying to use a variable that’s created in for example \_level5 as your target, and your also trying to load the value of that variable in \_root?

If so, try the following:

==Insert this into the other swf actions====  
Rev = eval(“this”);// change ‘this’ into the specified target in the other swf  
==Then just load that swf, and use levels to reference Rev for example===

loadMovie(“swfFile.swf”, \_level5.Rev);

Tell me how it goes.

---

<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 28, 2003, 3:25am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/5 "2003-01-28T03:25:52Z")

</div>

I made this attachment, with some code modification, and i got it working. :beam:

[edit]Rev1 is the main movie  
Rev2 is \_level2 (where you assign the variable rev)  
Rev3 is the movie where you want it to target \_level2.somemovie

I added some delay functions, you know, your trying to load a movie into \_level2 when \_level2 is still not created![/edit]

---

<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 28, 2003, 3:46am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/6 "2003-01-28T03:46:50Z")

</div>

> \*Originally posted by reverendflash \*  
> \*\*If I don’t use the variable, here is the code I use:

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

what I want to do, is replace panel1 with the variable named “panel” .

how do I write the syntax?

Thanks in advance for your help…

Rev \*\*

well… from what i understand i think you need to replace the

```php

loadMovie("../dodge/aarp1.jpg", _root._level40.panel1);

```

with

```php

loadMovie("../dodge/aarp1.jpg", _level40[panel]);

```

…

do i make sense?? or… am i totally misunderstanding 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: [January 28, 2003, 4:24am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/7 "2003-01-28T04:24:27Z")

</div>

Ahmed:

Thanks… that’s the ticket…

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 28, 2003, 4:28am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/8 "2003-01-28T04:28:33Z")

</div>

> \*Originally posted by reverendflash \*  
> \*\*Ahmed:

Thanks… that’s the ticket…

Rev \*\*

Oh ok, i was confused in the beginning and i didn’t understand you though.

Edit: actually my solution assigned the variable Rev to what ahmed posted above but in a different way! eval(“myMovie”) is actually the same as \_level40[“myMovie”]…

---

<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 28, 2003, 5:44am UTC](https://forum.kirupa.com/t/mx-how-to-pick-up-a-variable/12162/9 "2003-01-28T05:44:15Z")

</div>

hehe… glad its solved now…  
i think your way is correct too, but the \_level#[variable] is a kinda used more… i guess… or atleast among those who i knows… 🙂  
eval is deprecated
