# createClassObject()

**URL:** https://forum.kirupa.com/t/createclassobject/173968
**Category:** flash
**Created:** [December 31, 2005, 7:01pm UTC](https://forum.kirupa.com/t/createclassobject/173968 "2005-12-31T19:01:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![simpleSoft](https://avatars.discourse-cdn.com/v4/letter/s/8baadc/32.png) [@simpleSoft](https://forum.kirupa.com/u/simpleSoft)
#### Post date: [December 31, 2005, 7:01pm UTC](https://forum.kirupa.com/t/createclassobject/173968/1 "2005-12-31T19:01:39Z")

</div>

I’m trying to write the addition of Flash Components from within a Class file. So that class can control the component from within the object that I’m creating.

Here is my code

```auto

import mx.controls.Button;
 
class example extends MovieClip{
/**
 * This is here to allow for the use of the createClasObject within
 * the class; otherwise the compiler errors stating that their is no
 * such method.
 */
 private var createClassObject:Function;
 
function example() {
     createClassObject(Button, "clientID", incDepth(), {_x:20, _y:50, _width:80, _height:22.0, tabIndex:incTabNumber()});
}
 

```

Then I’m using this code to implement the object.

```auto

var chat:ChatModule = new ChatModule();

```

Yes I have already added the Component to the desktop and deleted it. The code is ported directly from an already working Flash MX 2004 application. So it worked there. What do I need to do to make it work with Flash 8.

Thanks,  
Ryan :thumb2:

Happy New Year!!
