# Dynamic Variable Name Question (quick and painless)

**URL:** https://forum.kirupa.com/t/dynamic-variable-name-question-quick-and-painless/247067
**Category:** flash
**Created:** [December 18, 2007, 6:14am UTC](https://forum.kirupa.com/t/dynamic-variable-name-question-quick-and-painless/247067 "2007-12-18T06:14:49Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nogame](https://avatars.discourse-cdn.com/v4/letter/n/f17d59/32.png) [@nogame](https://forum.kirupa.com/u/nogame)
#### Post date: [December 18, 2007, 6:14am UTC](https://forum.kirupa.com/t/dynamic-variable-name-question-quick-and-painless/247067/1 "2007-12-18T06:14:49Z")

</div>

I’ve had troubles with dynamic variable names in AS3. Though i’ve figured most of them out, this instance still gives me problems:

```auto

for each(var quest in questObject)
{
     var classRef:Class = getDefinintionByName('list_item') as Class;
     var questItem:MovieClip = new classRef();
     ui.addChild(questItem);
}

```

How would I syntactically solve the dynamic variable problem using the above example?
