# Dynamic class?

**URL:** <https://forum.kirupa.com/t/dynamic-class/282926>\
**Category:** flash\
**Created:** [February 27, 2009, 7:47pm UTC](https://forum.kirupa.com/t/dynamic-class/282926 "2009-02-27T19:47:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenBart](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@BenBart](https://forum.kirupa.com/u/BenBart)\
**Post date:** [February 27, 2009, 7:47pm UTC](https://forum.kirupa.com/t/dynamic-class/282926/1 "2009-02-27T19:47:57Z")

</div>

I have a jpeg that I have exported to actionscript via the library.  
The jpeg class is “adcouncil”. If I want to add it to the stage I would use the following code:

```auto
var adcouncil = new adcouncil1(150,150);
var myImage:Bitmap = new Bitmap(adcouncil)
printMC.addChild(myImage);

```

The problem is that I want to ad these Bitmaps to the stage dynamically. My first instinct is:

```auto
var adcouncil = new this["adcouncil1"](150,150);
var myImage:Bitmap = new Bitmap(adcouncil)
printMC.addChild(myImage);

```

But, that returns this error:  
TypeError: Error #1007: Instantiation attempted on a non-constructor.  
at index\_v1\_fla::MainTimeline/frame4()

Any clue how to do this?
