Dynamically (I think?) loading Movie Clips onto Stage... Easy Problem needs solving

Hello Kirupa fans…

I’ve made 2 MovieClips so far… “Terr1” & “Terr2” with the linkages to be exported.

and my script so far is this:

var landMap:Array = new Array();
landMap = [2,1,1,2,2];

//function to create landscape
function createLand(landAmount):void {
    for (var i=0; i<landAmount; i++) {

        var chosenLand:Number = landMap*;
        var terr = root["Terr" + chosenLand];


        root["piece" + i] = addChild(new terr());
        var thisPiece = root["piece" + i];
        var oldPiece = root["piece" + (i - 1)];

        //moving into the right place
        if (i <= 0) {
            thisPiece.x = 0;

        } else {

            thisPiece.x = (oldPiece.x + oldPiece.width);
        }


        thisPiece.bound.alpha = 0;
        thisPiece.y = stage.stageHeight;

    }


}

//calling create land function
createLand(landMap.length);
stop();

so far this works if I replace

root["piece" + i] = addChild(new terr());

with

root["piece" + i] = addChild(new Terr1())

.

but obviously that makes all the pieces “Terr1” I want to define which blocks to use in the “landMap” Array at the top of the code which is [2,1,1,2,2]… So on the display it shows “Terr2”, “Terr1”, “Terr1”, “Terr2”, “Terr2”

I’ve got as far as being able to change a variable “terr” to either “Terr1” or “Terr2” depending on which loop its on. but I cant find a way to do something like > " addChild(new terr()) "

Hope this makes sense, hope you can help.:cowbell:

My file is attached.