# "bugs" broken in flash8

**URL:** <https://forum.kirupa.com/t/bugs-broken-in-flash8/217223>\
**Category:** flash\
**Created:** [February 24, 2007, 2:32pm UTC](https://forum.kirupa.com/t/bugs-broken-in-flash8/217223 "2007-02-24T14:32:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![invisible7](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@invisible7](https://forum.kirupa.com/u/invisible7)\
**Post date:** [February 24, 2007, 2:32pm UTC](https://forum.kirupa.com/t/bugs-broken-in-flash8/217223/1 "2007-02-24T14:32:53Z")

</div>

I have this amusing script, forgot where it came from, that generates some random movement. It works exported as flash6 as2.0, but is broken in flash7 and up export. Wondering if someone could take a peak and see what the problem is. Thanks very much.

Fla. attached, but this AS just sits on an mc called queenBug.

[INDENT]//Create the mosquitoes  
onClipEvent (load) {  
// Number of mosquitoes  
num = 6;  
// Speed of flight (higher=faster)  
maxVel = 2;  
// Set the limits of the stage  
topLim = 0;  
botLim = 400;  
leftLim = 0;  
rightLim = 400;  
// Turn off the main mosquitoe  
queenBug.\_visible = false;  
// Clone the main mosquito (num) times  
for (i=1; i\<=num; i++) {  
queenBug.duplicateMovieClip(“bug”+i, i);  
bug = this[“bug”+i];  
bug.\_x = random(rightLim);  
bug.\_y = random(botLim);  
}  
}  
// Random movement code: Modify to acheive various results  
onClipEvent (enterFrame) {  
for (i=1; i\<=num; i++) {  
bug = this[“bug”+i];  
// Keep bugs within horizontal bounds (leftLim and rightLim)  
if (bug.\_x-bug.\_width\<leftLim) {  
bug.xVel = random(maxVel)+2;  
} else if (bug.\_x+bug.\_width\>rightLim) {  
bug.xVel = -(random(maxVel))-2;  
} else {  
bug.xVel = (random(100)\>50) ? random(maxVel)+1 : -(random(maxVel))-1;  
}  
// Keep bugs within vertical bounds (botLim and topLim)  
if (bug.\_y-bug.\_height\<topLim) {  
bug.yVel = random(maxVel)+2;  
} else if (bug.\_y+bug.\_height\>botLim) {  
bug.yVel = -(random(maxVel))-2;  
} else {  
bug.yVel = (random(100)\>50) ? random(maxVel)+1 : -(random(maxVel))-1;  
}  
// New bug location by a few random pixels dependent on speed variable maxVel  
bug.xV += bug.xVel;  
bug.yV += bug.yVel;  
if (bug.xV\>maxVel_2) {  
bug.xV = maxVel_2;  
} else if (bug.xV\<maxVel\*-2) {  
bug.xV = maxVel\*-2;  
}  
if (bug.yV\>maxVel_2) {  
bug.yV = maxVel_2;  
} else if (bug.yV\<maxVel\*-2) {  
bug.yV = maxVel\*-2;  
}  
// Set new bug location  
bug.\_x += bug.xV;  
bug.\_y += bug.yV;  
}  
}  
[/INDENT]
