OOP Question

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


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