有没有办法在ActionScript 3.0中将Class作为变量传递?
例如:
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;
答案 0 :(得分:2)
private var myType:Class = ClassA
var o:* = new myType();
o现在是ClassA的实例