for (i=0; i<3; i++) { anterior = i-1; //trace(anterior); // to see if it gets what you want. this["th"+i]._x = this["th"+anterior]._x+this["th"+anterior]._width; }