I'm pretty unexperienced with Action Script but searched the forums extensively to try and find a solution to this simple problem.
I'm creating several copies of a MovieClip but I need them to have different names.
// this array gets several cities
var cities:Array = new Array(
{ nome:"london", pos_x:20, pos_y:10 },
{ nome:"nyc", pos_x:210, pos_y:210 }
);
// now i would loop the cities array and create a copy of city_img for each
var k:*;
for each (k in cities) {
var mov:city_img = new city_img(); // city_img is a movieclip
addChild(mov);
mov.x = k.pos_x;
mov.y = k.pos_y;
mov.id = i;
i++;
}
This code works but, as expected, mov
gets id=1. Even though two movieclips are drawn on stage.
Can anyone help me on assign different names for each movieclip?