Using string to define function and variable(?)

And I’m back! Not surprisingly, I’m stumped again. This time around, I’m trying to make children of a tile and put them in their respective locations. To do that, I need to know what kind of tile is to be created, but if I just use my old method:

var Grass: GrassTile=new GrassTile();
Grass.name = "tile"+tileNum;
tileNum++;
[...]

I will have to use a chunk of code like this for every single imaginable tile. Obviously, that is not efficient! So I’m trying to optimize it by having what tile type is to be posted saved in a string, then using the string to refer to what child is to be created, something like below:

currentTile="GrassTile";
 var grass: currentTile=new currentTile();

But that code is no good. I’ve been wanting to fix this problem for a while now, but I never knew how to make the above code work. Surely, there is a way to do this?

Thank you for any assistance you can give!