# Dynamic Var name by another vars name possible?

**URL:** https://forum.kirupa.com/t/dynamic-var-name-by-another-vars-name-possible/331314
**Category:** flash
**Created:** [July 4, 2013, 2:51pm UTC](https://forum.kirupa.com/t/dynamic-var-name-by-another-vars-name-possible/331314 "2013-07-04T14:51:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![schulzzz13](https://avatars.discourse-cdn.com/v4/letter/s/f1d935/32.png) [@schulzzz13](https://forum.kirupa.com/u/schulzzz13)
#### Post date: [July 4, 2013, 2:51pm UTC](https://forum.kirupa.com/t/dynamic-var-name-by-another-vars-name-possible/331314/1 "2013-07-04T14:51:10Z")

</div>

I’m trying to update a variable in the root stage.  
The vars are called a1, a2, a3… and so on.  
In the child movieClips which instances are called “a1”, “a2”, “a3”… and so on, I tried this:

MovieClip(parent).a1 += 1;  
tracing and updating the parents var works.

When i try:  
trace(MovieClip(parent)+MovieClip(this).name);  
tracing works,but updating the var doesn’t:  
MovieClip(parent)+MovieClip(this).name += 1;

I tried  
(MovieClip(parent)+MovieClip(this).name) += 1;  
(MovieClip(parent) + “.” + MovieClip(this).name) += 1;  
(MovieClip(parent) + “.” + this) += 1;  
trace( MovieClip(root).name += 1;  
and some weird things with [] but nothing seems to work. Im on the wrong way or missing something.

I want to construct a var that is built by another vars name and then behaves like a var.  
e.g. var myVar = MovieClip(parent).name + “.” + MovieClip(this).name;  
But i fail and can’t use that var to manipulate it’s properties or value.  
AS3 throws a var called “whatever.a11” instead of using whatever.a1 adding 1.

Any ideas or help?
