# \[MX\] - using a variable to point out an instance name

**URL:** <https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575>\
**Category:** flash\
**Created:** [August 29, 2004, 2:10pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575 "2004-08-29T14:10:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adambiz](https://avatars.discourse-cdn.com/v4/letter/a/d6d6ee/32.png) [@Adambiz](https://forum.kirupa.com/u/Adambiz)\
**Post date:** [August 29, 2004, 2:10pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/1 "2004-08-29T14:10:34Z")

</div>

Hello,

Lets say I have a function that asks me for my name [whatsyourname(user)]. and I enter ‘adam’.  
And lets say I have an instance named “adamtwenty”, for example, I’d like to modify using the function.

How do I add the ‘twenty’ to the user name input (‘adam’), so I could change the instance?

adamtwenty,  
metwenty,  
youtwenty,  
thanksalottwenty,

adam.

---

<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:** [August 29, 2004, 3:26pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/2 "2004-08-29T15:26:24Z")

</div>

erm  
name+“twenty”  
:h:

Prophet.

---

<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:** [August 29, 2004, 4:48pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/3 "2004-08-29T16:48:37Z")

</div>

Thanks. I tryed that. It says “Left side of assignment operator must be variable or property. user+“cover”.\_alpha = 50;”

any ideas?

thanks,  
adam.

---

<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:** [August 29, 2004, 4:54pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/4 "2004-08-29T16:54:19Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?t=12082](http://www.kirupaforum.com/forums/showthread.php?t=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:** [August 29, 2004, 5:41pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/5 "2004-08-29T17:41:03Z")

</div>

I’m sorry for being a pain, but I still couldn’t find an answer to my problem…

```
 _root.bla = _root.user+"cover";
 _root.bla._alpha = 50;
 trace(_root.usercover._alpha);
 trace(_root.bla._alpha);

```

why does the first trace gives out “100”, and the second “undefined”?  
and, go\*\*\*\*, why none of them gives out 50?? 🙂

thanks!  
adam.

---

<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:** [August 29, 2004, 7:23pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/6 "2004-08-29T19:23:20Z")

</div>

im stil not quite sure what your asking for here…  
if you have a variable calld _user_ and you want to add the string _twenty_ to it, use this:  
user+=“twenty”

if you are trying to address an instance with instance name user plus a string, use this:  
\_root[user+“twenty”]

hope u got what you wanted…

Prophet.

---

<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:** [August 29, 2004, 9:40pm UTC](https://forum.kirupa.com/t/mx-using-a-variable-to-point-out-an-instance-name/62575/7 "2004-08-29T21:40:50Z")

</div>

I still can’t make it work… but thanks anyway all!

adam.
