# Array of images: Can't get the alignment right....!

**URL:** <https://forum.kirupa.com/t/array-of-images-cant-get-the-alignment-right/242842>\
**Category:** Uncategorized\
**Created:** [October 30, 2007, 10:12pm UTC](https://forum.kirupa.com/t/array-of-images-cant-get-the-alignment-right/242842 "2007-10-30T22:12:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davelaruedrum](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@davelaruedrum](https://forum.kirupa.com/u/davelaruedrum)\
**Post date:** [October 30, 2007, 10:12pm UTC](https://forum.kirupa.com/t/array-of-images-cant-get-the-alignment-right/242842/1 "2007-10-30T22:12:09Z")

</div>

Hi,  
I’m making an array of clickable images, based on kirupas gallery tutorial.  
I want images in rows and columns. To show images in rows and columns i need to change the .\_y and .\_x coordinate everytime the image hits the end of the screen…  
Here is the code:

```auto

tlistener.onLoadInit = function(target_mc) {
		target_mc._x = (target_mc._width+1)*k;
		
		**if (target_mc._x > 400){
			target_mc._y = target_mc._y + 70;
			target_mc._x = 0;
		}**
		
		trace("target_mc._x: "+target_mc._x);
		
		target_mc.pictureValue = k;
		target_mc.onRelease = function() {
			p = this.pictureValue-1;
			//nextImage();
		};
		
		target_mc.onRollOver = function() {
			this._alpha = 50;
// thumbNailScroller(); //add sound here
		};
		target_mc.onRollOut = function() {
			this._alpha = 100;
		};
	};

```

The output from this function is as follows:

traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 0  
traget\_mc: 303  
traget\_mc: 202  
traget\_mc: 101  
traget\_mc: 0

When the image’s x-coordinate is \> than 400 the image should shift down (using .\_y + 70), and the x-coordinate should be reset to zero to place the images right underneath another.  
BUT, when i set .\_x to zero it stays at zero throughout the rest of the loop…!!! (function calls)

Please help me…i’m baffled!!

Cheers,

Dave
