# Referencing a variable with a string

**URL:** https://forum.kirupa.com/t/referencing-a-variable-with-a-string/266854
**Category:** Uncategorized
**Created:** [July 24, 2008, 10:32pm UTC](https://forum.kirupa.com/t/referencing-a-variable-with-a-string/266854 "2008-07-24T22:32:37Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![sceneshift](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@sceneshift](https://forum.kirupa.com/u/sceneshift)
#### Post date: [July 24, 2008, 10:32pm UTC](https://forum.kirupa.com/t/referencing-a-variable-with-a-string/266854/1 "2008-07-24T22:32:37Z")

</div>

Hey guys,

I have a bunch of variables:

```
    [Embed(source="../assets/illustration.png")] public var illustration:Class;
    [Embed(source="../assets/illustration.png")] public var aboutme:Class;
    [Embed(source="../assets/illustration.png")] public var web:Class;
    [Embed(source="../assets/illustration.png")] public var photography:Class;    

```

And I am trying to call them with a string. So:

var test:Bitmap = new (STRING) as Bitmap;

Obviously the above example doesn’t work, I have tried using getDefinitionByName but to no avail, any ideas?
