I have an array of project type codes like this:
project_types_array[0] = "p"
project_types_array[1] = "exp"
etc.
and a corresponding set of movie clips, exported for actionscript, with names:
type_p
type_exp
etc.
I want to somehow dynamically attach a movieclip on the stage according to the project type that exists in the array. I could just do something like this:
for ( var i in project_types_array) {
if (project_types_array[i] == "p"){
var clip_p = new type_p();
container.header.type_loader.addChild(clip_p);
}
}
but I'd rather do something like this:
for ( var i in project_types_array) {
var "clip_" + project_types_array[i] = new "type_" + project_types_array[i]();
container.header.type_loader.addChild("clip_"+project_types_array[i]);
}
How do I achieve this?