Embarrassingly basic:
How, in AS, can you convert a string ("components.Comp1") into the
actual reference to the component?
I have a function that requires a parameter of type Class.
private function fAddCustomView(compClass:Class):void
>From an array I have a listing of package/components (as string):
"components.Comp1"
"components.Comp2"
"components.Comp3"
How can I convert these strings to actual references to the
components themselves...so I can send any selection into the
function as a Class?
I tried:
private function fAddComp():void
{
var clComp:Class = Class(acCompList.getItemAt(2).compname);
fAddCustomView(clComp);
}
private function fAddCustomView(compClass:Class):void
This didn't work. Error said:
"Type Coercion failed: cannot convert "components.Comp1" to Class."
Seems a basic question...How do you do it? Thanks.