I have an array of project code types, for example:
project_types_array[0] = "p"
project_types_array[1] = "exp"
and etc.
and the corresponding set of video clips exported for actionscript, with names:
type_p
type_exp
and etc.
I want to somehow dynamically attach a movie clip on the stage according to the type of project 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 would rather do something like this:
for (var I'm 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?
source
share