Casting string as a class
Hi. I have 52 symbols in my library each with class names Symbol1, Symbol2, Symbol3, etc. I want to create an array of these classes which will be used to create a random particle effect. How do I cast the var cardNumbers so that the array looks like this:
cardTypes = [Symbol1, Symbol2, Symbol3, etc]
instead of
cardTypes = ["Symbol1", "Symbol2", "Symbol3", etc]
This is what I have written so far...
var cardTypes:Array=new Array();
for(var i:Number = 0;i<52; i++)
{
var cardNumbers:String = "Symbol"+i;
cardTypes.push(cardNumbers);
}
Any help would be much appreciated.
|