# OOP Question

**URL:** <https://forum.kirupa.com/t/oop-question/331001>\
**Category:** Uncategorized\
**Created:** [April 24, 2013, 2:25pm UTC](https://forum.kirupa.com/t/oop-question/331001 "2013-04-24T14:25:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [April 24, 2013, 2:25pm UTC](https://forum.kirupa.com/t/oop-question/331001/1 "2013-04-24T14:25:28Z")

</div>

Hey guys, I just started to migrate to AS3 (yes, I know its late), and I’m having trouble programming in OOP.

```auto

function generateItem(item:*)
{
    var testItem:item = new item();
}
generate_btn.addEventListener(MouseEvent.CLICK , generateItem(solarbeam));

```

I get a “Type was not found or was not a compile-time constant: item” error.

Heres what I’m trying to do:

Use the “generateItem” function to create a instance of whatever class the “item” parameter is. (eg. generateItem(item1), generateItem(item2), etc.)

I think the problem is Flash is reading “item” as a class instead of a parameter, and since I have no class named “item” , it comes up as a error.

If there is a better way of doing this, please let me know.

Any help is appreciated.

Thanks.

-Jephz
