Say I have a variable that contains an instance of a class. Is there any way to return a “Class” object based on what type that variable is?
I wish there was something like this:
var button:SimpleButton = new SimpleButton();
this.addChild(duplicate(button));
function duplicate(target:Object):Object
var mainClass:Class = target.baseClass; //Yes, I know the "baseClass" function doesn't exist. This is what I want.
var cloneObj:Button = new MainClass();
return cloneObj;
}
I am able to extract the class name in text format, and even all items that it extends and interfaces, yet I cannot find any way to create a class based on
I did find the function “getDefinitionByName()” and “getClassByAlias()”, but if I understand correctly, you have to first register those definitions.
Also, is it possible to extract usable Classes (not just display objects) out of externally loaded SWFs?