How to pass a class as a variable?
Is there a way to pass a Class as a variable in Actionscript 3.0?
For example:
private var myType:* // not sure how to 开发者_运维知识库pass, it's a class which implements an interface
myType = ClassA; // myType is now ClassA which extends Sprite;
myType = ClassB; // myType is now ClassB which extends Sprite;
private var myType:Class = ClassA
var o:* = new myType();
o is now an instance of ClassA
精彩评论