# Accessing variable of parent from string?

**URL:** https://forum.kirupa.com/t/accessing-variable-of-parent-from-string/305593
**Category:** flash
**Created:** [February 28, 2010, 3:08am UTC](https://forum.kirupa.com/t/accessing-variable-of-parent-from-string/305593 "2010-02-28T03:08:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![pcehnaids](https://avatars.discourse-cdn.com/v4/letter/p/90ced4/32.png) [@pcehnaids](https://forum.kirupa.com/u/pcehnaids)
#### Post date: [February 28, 2010, 3:08am UTC](https://forum.kirupa.com/t/accessing-variable-of-parent-from-string/305593/1 "2010-02-28T03:08:01Z")

</div>

I understand that in AS3 if you want to access a variable in a parent movie from a child you use:

```auto
(this.parent as MovieClip).my_variable

```

but what if you wanted to access a variable from a string?  
EX:

```auto
var varString:String = "myVar";
(this.parent as MovieClip)[COLOR=Red].varString[/COLOR] ???

```

[COLOR=Black]  
I have tried:  
[/COLOR]

```auto
(this.parent as MovieClip).this[varString]

```

[COLOR=Black]  
but it doesn’t seem to work. Help would be greatly appreciated.

[/COLOR][COLOR=Black]

[/COLOR]
