# Plz i need help with FOR loop i need it fast(plz)

**URL:** <https://forum.kirupa.com/t/plz-i-need-help-with-for-loop-i-need-it-fast-plz/254651>\
**Category:** Uncategorized\
**Created:** [March 13, 2008, 9:05pm UTC](https://forum.kirupa.com/t/plz-i-need-help-with-for-loop-i-need-it-fast-plz/254651 "2008-03-13T21:05:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blessoul](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@blessoul](https://forum.kirupa.com/u/blessoul)\
**Post date:** [March 13, 2008, 9:05pm UTC](https://forum.kirupa.com/t/plz-i-need-help-with-for-loop-i-need-it-fast-plz/254651/1 "2008-03-13T21:05:02Z")

</div>

hi i im from venezuela so my english is no so good sorry for that but i have a problem with the for loop

so heres the problem have a fly movieclip thats lincked as fly and i need 20 of them that move ramdomly i have that part done but I dont know how to make the 20 fly move beacuse is with an enterframe event and i need that wen i click it it disapears(i know how to make that 😉 so heres the code so far for one fly:

> 

mosca.stop();  
aplastado = false;  
acceleration = 10;

for (i = 0; i \< 20; i++) {  
mc = attachMovie(“mosca”, “mosca” + i, 100 + i);  
mc.stop();  
mc.\_x = Math.random() \* Stage.width;  
mc.\_y = Math.random() \* Stage.height;  
newpos();  
}  
newpos = function () {  
ranx = Math.round((Math.random() \* Stage.width));  
rany = Math.round((Math.random() \* Stage.height));  
};  
newpos();  
mosca.onEnterFrame = function() {  
if (!aplastado) {  
this.\_x += ((ranx - this.\_x) / acceleration);  
this.\_y += ((rany - this.\_y) / acceleration);  
if (Math.round(this.\_x) == ranx || Math.round(this.\_y) == rany) {  
newpos();  
}  
}  
if (aplastado) {  
this.\_alpha -= 5;  
}  
if (this.\_alpha == 0) {  
removeMovieClip(this);  
}  
};

mosca.onRelease = function() {  
this.gotoAndStop(“aplastado”);  
aplastado = true;  
i–;  
};

i will apreciate a lot the help tnx
