# Loop for.... not finishing

**URL:** <https://forum.kirupa.com/t/loop-for-not-finishing/252997>\
**Category:** flash\
**Created:** [February 26, 2008, 7:51am UTC](https://forum.kirupa.com/t/loop-for-not-finishing/252997 "2008-02-26T07:51:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sabee77](https://avatars.discourse-cdn.com/v4/letter/s/94ad74/32.png) [@sabee77](https://forum.kirupa.com/u/sabee77)\
**Post date:** [February 26, 2008, 7:51am UTC](https://forum.kirupa.com/t/loop-for-not-finishing/252997/1 "2008-02-26T07:51:48Z")

</div>

Hi there,  
I’m having a really hard time with a loop for code (wich simply sets properties of an array of Btn on stage).  
When I play my movie locally, I don’t have any problem.  
But when I play it inside the browser, it shows up.

The problem is that the for loop get stuck just 1 iteration before the end. As it doesn’t finish the loop, the rest of the code doesn’t execute and my app don’t work. To add a little bit more confusiness, if I reload the page it does finish the loop… BUT, I must reload it almost like a double click (don’t let time to flash to show anything betweens to clicks or “reload”).

You can see it here: [http://www.motionfeel.com/laya/swf/main.swf](http://www.motionfeel.com/laya/swf/main.swf)

And the loop code is this:

for (var i:uint = 0; i\< numBtns; i++) {  
var vBtn:\* = listRefBtns\*;  
var positionInSpace = listPositions\*[0];  
var randomInstep = listPositions\*[1];

vBtn.y = positionInSpace \* SpaceV + (SpaceV \* 0.5 \* randomInstep);  
if (vBtn.y \> 1000) {  
vBtn.y -= heightTotal;  
}  
vBtn.initY = vBtn.y;  
vBtn.posRelative = positionInSpace;  
vBtn.pctOff = randomInstep;

// TRACE TEXT  
vTexte += (i + " / " + numBtns + " : " + vBtn.name + "  
");  
refParent.refGalaxy.refMain.tempTxt.text = vTexte;  
}  
Nothing really fancy I think, and I repeat it does work perfectly at runtime (local)  
If anyone has got an idea of what it could be. I started looking at the Garbadge Colector but don’t see anything there.  
Any help would be really apreciated!  
Thank you,  
seb.
