For Loop help

This comes up a lot for me. I want to place MC using a for loop that checks the previous MC’s _x and places the next one 90 pixels to the right. Use an if to check to make sure the _x is not past 260 if it is move the _y 90 pixels and reset the the _x.

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);
 }
}