Reputation: 21924
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;
Upvotes: 0
Views: 157
Reputation: 8875
private var myType:Class = ClassA
var o:* = new myType();
o is now an instance of ClassA
Upvotes: 2