This is hard to describe in a sentence, so i'll write some false code: (with incorrect syntax, of course)
Code:
function placeIcon(varType:String) {
myIcon:'varType' = new 'varType'();
}
...where varType would be a String reading "MovieClip", or "Sprite", or the names of custom clips from the library.
Is it possible to do something like this, where I pass the name of the data Type that I want it to create and it does it within the function? And I know that with this simple example it isn't necessary to do it this way, but in the full program this would save some time and make the code more efficient.
I tried searching, but can't come up with the correct key words to find what i'm looking for.
Thanks