# Help with my forloop

**URL:** <https://forum.kirupa.com/t/help-with-my-forloop/264082>\
**Category:** Uncategorized\
**Created:** [June 23, 2008, 1:32am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082 "2008-06-23T01:32:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 23, 2008, 1:32am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/1 "2008-06-23T01:32:17Z")

</div>

What I have is the initial forloop that gets the fabric sections. Then a forloop within this loop to get the subsections.

the locations of where the thumbs in the subsection should go are stored in the destThumb variables and then fed through to an easing function.

however, each subsection group is also aligned depending on the previous subsection.\_height. So the thumbs are going to their right relative positions, but the subsections are not.  
I’m assuming this is because the .\_heights are being calculated instantly as the thumbs are beginning to ease, therefore making subsection only the height of one row of thumbs.

now what are my solutions? canI use a setInterval somewhere to have the forloop pause before it loops again? Allowing time for the thumbs to ease in place creating the final height?

this is just the top snippet of code:

for (var i = 0; i\<theFabrics.length; i++) {

```
var storeHeight = materialSection._height;
var storeYLoc = materialSection._y;
var matFabrics = theFabrics*.childNodes;
var matType = theFabrics*.attributes.type;
var materialSection = mainSubThumbs.createEmptyMovieClip("SubThumbsHolder"+i, i);
//thumbnail holder

for (var s = 0; s&lt;matFabrics.length; s++) {
	var currentSubPicture = matFabrics[s];
	var currentSubThumb = materialSection.createEmptyMovieClip("subthumb_mc"+s, s);
	var containerSubThumb = currentSubThumb.createEmptyMovieClip("subcontainer"+s, s);
	currentSubThumb.attachMovie("subthumb_bg_mc","subthumb_bg_mc"+s,s-1);
	if (s&lt;4) {
		destThumbX = s*thumb_space;
		destThumbY = 0*thumb_rowspace;
	} else if (3&lt;s and s&lt;8) {
		destThumbX = (s*thumb_space)-(4*thumb_space);
		destThumbY = 1*thumb_rowspace;
	} else if (7&lt;s and s&lt;12) {
		destThumbX = (s*thumb_space)-(8*thumb_space);
		destThumbY = 2*thumb_rowspace;
	} else if (11&lt;s and s&lt;16) {
		destThumbX = (s*thumb_space)-(12*thumb_space);
		destThumbY = 3*thumb_rowspace;
	} else if (15&lt;s and s&lt;20) {
		destThumbX = (s*thumb_space)-(16*thumb_space);
		destThumbY = 4*thumb_rowspace;
	}

	easeName(destThumbX,destThumbY,currentSubThumb);
```

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 23, 2008, 8:03am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/2 "2008-06-23T08:03:44Z")

</div>

you would have to calculate the height before hand I guess

put it in the xml?

---

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 23, 2008, 11:18am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/3 "2008-06-23T11:18:59Z")

</div>

or i guess i could calculate the height earlier, somehow. Thanks

Another question. the thumbs do ease to their spots. but all at the same time. How can I have them ease one after another?

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 23, 2008, 11:54am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/4 "2008-06-23T11:54:27Z")

</div>

if you use loadClip/ / onIntialise() or something checks size once loaded

you increment the tween in terms of the time it takes so the first is 1_1, the next is 1_2

---

<div class="post-metadata">

**Author:** ![geestring](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@geestring](https://forum.kirupa.com/u/geestring)\
**Post date:** [June 24, 2008, 12:23am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/5 "2008-06-24T00:23:01Z")

</div>

im using a loadClip.  
do i need to use some sort of setInterval function?

---

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [June 24, 2008, 8:14am UTC](https://forum.kirupa.com/t/help-with-my-forloop/264082/6 "2008-06-24T08:14:18Z")

</div>

tweens have their own setinterval() as it were

you have to remember I doing this in my spare time don’t expect me to remember the specifics
