# Dynamic references to classes in AS3

**URL:** https://forum.kirupa.com/t/dynamic-references-to-classes-in-as3/323064
**Category:** flash
**Created:** [June 15, 2011, 3:38pm UTC](https://forum.kirupa.com/t/dynamic-references-to-classes-in-as3/323064 "2011-06-15T15:38:47Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![theMonitor](https://avatars.discourse-cdn.com/v4/letter/t/ecb155/32.png) [@theMonitor](https://forum.kirupa.com/u/theMonitor)
#### Post date: [June 15, 2011, 3:38pm UTC](https://forum.kirupa.com/t/dynamic-references-to-classes-in-as3/323064/1 "2011-06-15T15:38:47Z")

</div>

Hope someone can help here… as alway, I’ve dug around for an answer, but in this case nothing directly relevant seems to have fetched up…

I have four movie clips in my library that are defined as classes: Option0, Option1, Option2 and Option3. I have four buttons that pass a different value from 1-4 to a function. I want to add the clip to the display list that relates to the passed value.

In AS2 it would go something like:

this.attachmovie[“option”+currentVal, “newOption”, this.getNextHighestDepth()];

How should I go about doing this in AS3?
