Can I use a variable inside addChild()?

Here’s my (simplified) code:


var doorType:String = "DT0";
var openType:String = "OT0";
var imagePositioner:Sprite = new Sprite(); //Places a Sprite that will "contain" all the images.
this.addChildAt(imagePositioner,0);

var OT1_aluminum_exit:DisplayObject = new ot1_aluminum_exit();
var OT1_wood_exit:DisplayObject = new ot1_wood_exit();
var OT1_glass_exit:DisplayObject = new ot1_glass_exit();
var OT1_metal_exit:DisplayObject = new ot1_metal_exit();

var OT2_aluminum_exit:DisplayObject = new ot2_aluminum_exit();
var OT2_wood_exit:DisplayObject = new ot2_wood_exit();
var OT2_glass_exit:DisplayObject = new ot2_glass_exit();
var OT2_metal_exit:DisplayObject = new ot2_metal_exit();


//DT1, 2, 3 and 4 are radio buttons
DT1.addEventListener(MouseEvent.CLICK, doorTypeHandler);
DT2.addEventListener(MouseEvent.CLICK, doorTypeHandler);
DT3.addEventListener(MouseEvent.CLICK, doorTypeHandler);
DT4.addEventListener(MouseEvent.CLICK, doorTypeHandler);
function doorTypeHandler(event:MouseEvent):void {
    doorType = event.target.value; //re-assigns a value to doorType
    if (imagePositioner.numChildren >= 1) {
        imagePositioner.removeChildAt(0);
        } // Clears the imagePositioner so images don't stack
    if (doorType == "DT1") {
        imagePositioner.addChild(OT1_aluminum_exit);
            } else if (doorType == "DT2") {
            imagePositioner.addChild(OT1_wood_exit);
                } else if (doorType == "DT3") {
                imagePositioner.addChild(OT1_metal_exit);
                    } else if (doorType == "DT4") {
                    imagePositioner.addChild(OT1_glass_exit);
                    }
}

I am effectively trying to replace “imagePositioner.addChild(OT1_aluminum_exit);” with something like “imagePositioner.addChild(the current value of openType_aluminum_exit);”.

openType is defined on a previous screen, it will be equal to OT1 or OT2. I have two sets of images (movie clips) that each have a prefix of “ot1_” or “ot2_” (in their class name). Other than those prefixes the two sets of image names are the same. I think I could cut the amount of code in half if I could use a variable when I use addChild.

I am thinking the solution to this is simple but I am not very knowledgeable of AS3 and everything I’ve tried has failed. My theory is that addChild() needs to contain a movieclip, so putting a variable name in addChild() doesn’t work. I can’t seem to figure out how to do it!

Please let me know if I need to clarify.
Thanks!