# \[MX\] variable as part of a dot address; possible?

**URL:** https://forum.kirupa.com/t/mx-variable-as-part-of-a-dot-address-possible/59178
**Category:** flash
**Created:** [July 29, 2004, 2:36am UTC](https://forum.kirupa.com/t/mx-variable-as-part-of-a-dot-address-possible/59178 "2004-07-29T02:36:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![ChainMael](https://avatars.discourse-cdn.com/v4/letter/c/3be4f8/32.png) [@ChainMael](https://forum.kirupa.com/u/ChainMael)
#### Post date: [July 29, 2004, 2:36am UTC](https://forum.kirupa.com/t/mx-variable-as-part-of-a-dot-address-possible/59178/1 "2004-07-29T02:36:12Z")

</div>

What I’m talking about is, is it possible to do something like:

\_root.MyVariable.gotoAndPlay(25);

…when MyVariable would happen to be the name of a movieclip sitting in \_root?

If it is possible, what would the syntax be? I’ve tried a few things with no luck. :crazy:

---

<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 29, 2004, 12:41pm UTC](https://forum.kirupa.com/t/mx-variable-as-part-of-a-dot-address-possible/59178/2 "2004-07-29T12:41:36Z")

</div>

use:

\_root[MyVariable].gotoAndPlay(25); //no dot in front of the []

the stuff inside the [] counts as one mc. you cannot enter a path inside  
like ["\_root."+MyVariable].gotoAndPlay(25); \<-false  
or

eval(MyVariable).gotoAndPlay(25); //there is nothing in front of the eval() otherwise it wouldn’t work  
you can use eval too if the whole path is a variable, i.e.:

//mc path to reach is \_root.abc.def.ghi  
MyVariable=def.ghi  
eval("\_root.abc."+MyVariable).gotoAndPlay(25);  
would 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: [July 30, 2004, 11:00am UTC](https://forum.kirupa.com/t/mx-variable-as-part-of-a-dot-address-possible/59178/3 "2004-07-30T11:00:06Z")

</div>

That did the trick, thanks McGiver.

I used the \_root[MyVariable] version, worked like a charm.
