DisplayObject and addChild craziness

I posted this in “Flash CS3” but realized that was probably the wrong place for it… I apologize for the double post but I didn’t know how to move it.

I am working on a project where we are making a “wizard” where you answer a series of questions and in the end you are presented with a “parts list” based on your answers. There is also logic which decides which questions you are asked based on how you have answered certain questions so far.

The outcome is a list of door control hardware (locks, mounting plates, handles etc. etc.). While you are answering questions I need to show a “live image” of the parts list as it builds.

For example one of the questions is this:
Door Type?
A) Aluminum
B) All Glass
C) Wood

Depending on which you choose I need to show an image of an aluminum, glass or wooden door. Then if the next question is about lock types then your new lock shows up and so on and so forth until you reach the end.

The questions all relate to their own variable which are each defined at the beginning of the movie like this:

var doorType:String = "DT0";

The questions use radio buttons and each question (re)defines it’s variable like this


DT1.addEventListener(MouseEvent.CLICK, doorTypeHandler);
DT2.addEventListener(MouseEvent.CLICK, doorTypeHandler);
DT3.addEventListener(MouseEvent.CLICK, doorTypeHandler);
function doorTypeHandler(event:MouseEvent):void {
       doorType = event.target.value;
}

So if I choose C (wood door) the variable doorType now equals DT3.

So far so good.

Now I need to show (and perhaps hide) different images depending on what they have selected. From what I’ve read it sounds like a good way to do this is to use DisplayObject and addChild. I have never used either so I decided to make a little test movie to try it out.
This is my code (note: ot2_wood_exit is the class name for the movieclip with the image of the wooden door)


var currImage:DisplayObject;
currImage = new ot2_wood_exit();
currImage.x = 150;
addChild(currImage);

This works nicely.

Now the tricky part (for me at least) is figuring how in the world to use this in conjunction with the questions (more accurately, the variables they define) to produce this live image.

Another thing to add complication to this whole mess is that there are basically two entire sets of images. Single doors or Double doors, they both have (nearly) all the same hardware but they are two different sets of images. They are differentiated by the ot1 or ot2 in front of the class name. The variable openType defines OT1 or OT2 in a previous question. I would like to be able to use the variable openType in the call for the image


//This is how I tested it
currImage = new ot2_wood_exit();

//I would like to use openType instead of hard coding ot1 or ot2
currImage = new openType_wood_exit(); //I KNOW this is wrong, but I don't know what is right! 

So that is my basic dilemma. I need to show or hide specific images based on the answers to previously answered questions AND questions currently being answered (live update). I am sure there is an efficient way to do this I just can’t seem to figure it out!

Some additional details about the project that might help:
ActionScript 3
There are approximately 50 images for each openType (OT1 and OT2)
Each set/page of questions (usually 2 or 3 questions) is on it’s own frame
The images are PNGs and I’ve made movie clips of all of them (with classes)

Any direction, guidance, suggestions or ideas are welcome! And of course I have a crazy deadline, that’s what makes this fun right?! Thank you in advance!
-Logan