# createClassObject returning null value when creating dynamic components

**URL:** <https://forum.kirupa.com/t/createclassobject-returning-null-value-when-creating-dynamic-components/295911>\
**Category:** Uncategorized\
**Created:** [September 7, 2009, 9:50am UTC](https://forum.kirupa.com/t/createclassobject-returning-null-value-when-creating-dynamic-components/295911 "2009-09-07T09:50:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qburst](https://avatars.discourse-cdn.com/v4/letter/q/f07891/32.png) [@qburst](https://forum.kirupa.com/u/qburst)\
**Post date:** [September 7, 2009, 9:50am UTC](https://forum.kirupa.com/t/createclassobject-returning-null-value-when-creating-dynamic-components/295911/1 "2009-09-07T09:50:33Z")

</div>

createClassObject returning null value when creating dynamic components.

I am using the following code

var \_\_reg2 = new Object();  
\_\_reg2.label = \_label;  
\_\_reg2.\_width = \_w;  
\_\_reg2.\_height = \_h;  
\_\_reg2.\_x = this.width / 2 - \_w / 2;  
\_\_reg2.\_y = this.height / 2 - \_h / 2;  
\_\_reg2.\_alpha = 0;

this.launch\_button = this.mc.createClassObject(controls.PixtorieButton, “launch\_button”, this.mc.getNextHighestDepth(), \_\_reg2);

this.mc is a movieclip which has the correct value during runtime but when i use createClassObject() with it its always returning null value.

I have the component dragged into my library.

Also the code fails even when i am using mx.controls.Button instead of controls.PixtorieButton .

Any help will be greatly appreciated

Thanks in advance
