2011-02-10 103 views
0

有沒有辦法在ActionScript 3.0中作爲變量傳遞一個類?如何將類作爲變量傳遞?

例如:

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; 

回答

2
private var myType:Class = ClassA 
var o:* = new myType(); 

ø現在是ClassA的

一個實例