This comes up often for me when coding. How do you target the previous MC in a for loop. Basically I am attaching MC’s to the stage that are 90 Pixels apart from the top and bottom. I want to check the _x location of the previous MC and move in 90 pixels. Use an If statement so the _x location is not beyond 260 and if it is it moves _y 90 pixels and resets the _x. Is this the best way to do it.
function yelGallery () {
for (var i = 10; i < 20; i++) {
var galleryMC:MovieClip = (_root.attachMovie ("galleryMC", "galleryMC" + i, i));
galleryMC10._x = 70;
trace (this.galleryMC) -1))
if (this.galleryMC._x > 260) {
this.galleryMC._x = 70;
this.galleryMC._y = /*how do I target the previous MC*/this.galleryMC._y + 90;
} else {
this.galleryMC._x = this.galleryMC._x + 90;
}
_root.myMCL.loadClip ("Galleries/forSale/tn_forSale/tn_painting" + curPaintingNum + ".jpg", _root.galleryMC);
}
}