# Instantiate Class with Dynamic Name

**URL:** <https://forum.kirupa.com/t/instantiate-class-with-dynamic-name/328825>\
**Category:** flash\
**Created:** [June 20, 2012, 10:59pm UTC](https://forum.kirupa.com/t/instantiate-class-with-dynamic-name/328825 "2012-06-20T22:59:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![klmillis](https://avatars.discourse-cdn.com/v4/letter/k/7ea924/32.png) [@klmillis](https://forum.kirupa.com/u/klmillis)\
**Post date:** [June 20, 2012, 10:59pm UTC](https://forum.kirupa.com/t/instantiate-class-with-dynamic-name/328825/1 "2012-06-20T22:59:49Z")

</div>

Hello all,

I have no idea how to do this, but I’m sure it is relatively straightforward… or so I hope. I’ve gone through many good hits, but can’t make it work the way it’s discussed.

import flash.display.Sprite;  
import flash.display.Bitmap;

var imageSprite:Sprite;  
imageSprite = new Sprite();  
addChild(imageSprite);

var libraryImage:Bitmap = new Bitmap(new image1(0,0));

imageSprite.addChild(libraryImage);

The above works just fine, but what I want to do is reference the image1 class incrementaly. That is image2, image3, image4, etc.

Any help is appreciated.

K
