开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜