# Possible to use String value as Variable?

**URL:** https://forum.kirupa.com/t/possible-to-use-string-value-as-variable/328515
**Category:** flash
**Created:** [May 22, 2012, 5:51pm UTC](https://forum.kirupa.com/t/possible-to-use-string-value-as-variable/328515 "2012-05-22T17:51:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![coreymill](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@coreymill](https://forum.kirupa.com/u/coreymill)
#### Post date: [May 22, 2012, 5:51pm UTC](https://forum.kirupa.com/t/possible-to-use-string-value-as-variable/328515/1 "2012-05-22T17:51:59Z")

</div>

I am relatively new to AS3 and have never attempted using Strings so I am not having any luck getting this to work and honestly don’t even know if it’s possible.

For example:

```auto
var varName:String;
varName = "vet"

//The next line should read
//var bitFile = new vet(100, 100);

var bitFile = new varName(100, 100); 
var lineart = new Bitmap(bitFile);
canvas.addChild(lineart);

```

I currently have to re-write the entire bit of code for any different image that I am using. However, I would like to be able to just change a single variable (varName) when loading a different image.

Any help/insight would be greatly appreciated.  
Thanks.
