# \[AS 2.0\] Looping can't stop

**URL:** <https://forum.kirupa.com/t/as-2-0-looping-cant-stop/328592>\
**Category:** Uncategorized\
**Created:** [May 29, 2012, 5:03am UTC](https://forum.kirupa.com/t/as-2-0-looping-cant-stop/328592 "2012-05-29T05:03:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Noth1ng](https://avatars.discourse-cdn.com/v4/letter/n/f475e1/32.png) [@Noth1ng](https://forum.kirupa.com/u/Noth1ng)\
**Post date:** [May 29, 2012, 5:03am UTC](https://forum.kirupa.com/t/as-2-0-looping-cant-stop/328592/1 "2012-05-29T05:03:16Z")

</div>

hi there , this is my first post  
i’m still newbie and i try to use this looping but it can’t stop ,

> springload();

function springload():Void  
{  
var dfly\_depth:Number = 10;  
var border\_depth:Number =2;

```
attachMovie("border_mc","border_mc",border_depth);
createdfly();

```

}

//Border Dimentions setting  
var topBorder:Number = 50  
var leftBorder:Number = 0  
var botBorder:Number = border\_mc.\_height;  
var rightBorder:Number = border\_mc.\_width = 700;

/\*  
\*Dragonfly function  
\*/

function createdfly():Void  
{  
spawndfly = 0;  
border\_mc.onEnterFrame = function ()  
{  
spawndfly++; // Time to spawn  
for(i=0;i\<5;i++)  
{  
if (spawndfly == 45) //// \<\<\<— i wonder if the looping cant stop because of this …  
{

```
                //attach movieclip from the library

```

[SIZE=1]var tempdfly = border\_mc.attachMovie(“dfly\_mc”, “dfly\_mc”+border\_mc.getNextHighestDepth(), border\_mc.getNextHighestDepth(),{\_x:random(400), \_y:random(330)});[/SIZE]  
spawndfly = 0;  
}  
}  
}  
}

i try to trace the i and the spawndfy , n what i get is getting confused …

i’ll use the “spawndfy” to make dragonfly spawn one by one …

Thx so much for the attention
