Hello guys,
Does anybody know how to work with to a movie clip generated like this:
for (j=0; j<10; j++) {
one_mc.duplicateMovieClip("clip["+j+"]_mc",j);
}
I just want to skip all this:
clip0_mc.onPress = function () {...};
clip1_mc.onPress = function () {...};
...................................................
clip40_mc.onPress = function () {...};
and make something like this, but something that works.
for (j=0;j<10;j++) {
_root["clip["+j+"]_mc"].onPress = function() {...}
}
At someone suggestion I tried this way:
for (var i:Number = 0; i < 10; i++)
{
one_mc.duplicateMovieClip("clip" + i + "_mc", i);
this["clip" + i + "_mc"]._x = i*55;
this["clip" + i + "_mc"]._y = i*10;
this["clip" + i + "_mc"].onPress = function () {
out_txt.text = "i = " + i;
};
}
but the out_txt always shows “10” I want it to show 0 or 1 or 2 or…
I have an example here: http://gabriell.sufx.net/test.swf the last code typed here + one_mc (the rectangle) + out_txt(an input text)
I hope I make myself clear:D
Kind regards for reading this.