# Placing instances using for function

**URL:** https://forum.kirupa.com/t/placing-instances-using-for-function/270375
**Category:** flash
**Created:** [September 9, 2008, 10:09am UTC](https://forum.kirupa.com/t/placing-instances-using-for-function/270375 "2008-09-09T10:09:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Rundevo](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@Rundevo](https://forum.kirupa.com/u/Rundevo)
#### Post date: [September 9, 2008, 10:09am UTC](https://forum.kirupa.com/t/placing-instances-using-for-function/270375/1 "2008-09-09T10:09:38Z")

</div>

Hi guys!

I need som help placing 16 instances of a component using a for function.

```auto
for (var i:int = 0; i < xmlList.length(); i++)
		{
			thumbLoader = new Loader();
			thumbLoader.source = xmlList*.attribute("thumb");
			thumbLoader.x = i * 140;
			thumbLoader.y = 0;
			thumbLoader.name = xmlList*.attribute("source");
			addChild(thumbLoader);
			thumbLoader.addEventListener(MouseEvent.CLICK, showThumb);

		}

```

Thats the code that I´m using now, but I wonder if someone can help me to change the .y value after 4 instances has been placed on the .x axis, so I get four different lines with four on every line.

Any takers? 🙂

/rundevo
