# Bubbles

**URL:** <https://forum.kirupa.com/t/bubbles/188878>\
**Category:** Uncategorized\
**Created:** [May 11, 2006, 2:49pm UTC](https://forum.kirupa.com/t/bubbles/188878 "2006-05-11T14:49:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bonwhis](https://avatars.discourse-cdn.com/v4/letter/b/b77776/32.png) [@Bonwhis](https://forum.kirupa.com/u/Bonwhis)\
**Post date:** [May 11, 2006, 2:49pm UTC](https://forum.kirupa.com/t/bubbles/188878/1 "2006-05-11T14:49:45Z")

</div>

I need to create some bubbles going to the surface while getting bigger. I would like it to only have a row at a time containing 5-8 bubbles. When they hit the surface they should pop. As I have not been able to find a tutorial doing exactly that. So I had to compromise, as I found a snowflake tutorial. I used the following actionscript in the movieclip. It however doesn’t work with the Flashplayer 8.

onClipEvent (load) {  
//variables  
width = 40;  
height = 80;  
//random x,y, and alpha  
this.\_xscale = this.\_yscale=50+Math.random()_100;  
this.\_alpha = 20+Math.random()50;  
//random x and y for flakes  
this.\_x = -width+Math.random()(3_width);  
this.\_y = -10+Math.random()\*height;  
//speed and trigonometric value  
i = 1+Math.random()\*2;  
k = -Math.PI+Math.random()_Math.PI;  
rad = 0;  
}  
onClipEvent (enterFrame) {  
// horizontal movement  
rad += (k/10)Math.PI;  
/xmovement = \_root.\_xmouse;/  
this.\_x -= Math.cos(rad)+(xmovement-(width/2))/100;  
// vertical movement  
this.\_y -= i;  
// remove clips when they misbehave (overstep boundaries)  
if (this.\_x\>(width+50)) {  
this.\_x = -45;  
this.\_y = Math.random()height2;  
}  
if (this.\_x\<-50) {  
this.\_x = width+45;  
this.\_y = Math.random()height2;  
}  
if (this.\_y\<=height) {  
this.\_y = 210;  
this.\_x = -width+Math.random()(3_width);  
}  
}

and this one in the frame of the movieclip…

snowflakes = 4;  
do {  
duplicateMovieClip(snow, “snow”+k, k);  
k++;  
} while (k != snowflakes);

Can anyone tell me what the problem is. As I am not super good at Actionscript I would really appreciate if any of you gurus know a good tutorial or have a similar script laying around for share please let me know?

Thanks

-BonWhis
