PDA

View Full Version : Is this possible?


kendric
02-18-2008, 06:51 PM
I can make an instance of a class that I have by doing this:
var ClassRefrence:Class=getDefinitionByName(getQualifi edClassName(obj)) as Class;
return new ClassRefrence();

Is there a way to do it without the string lookup and then conversion back to a class?
Here are 2 things it would be neat to be able to do

somewhere you have defined a class TestClass

var obj:TestClass;
return new obj.class();

Thanks

newblack
02-18-2008, 08:01 PM
protected var _class:Class = com.yourDomain.SomeClass;
//instantiated like so:
var someClass:SomeClass = SomeClass( new _class() );