# \[Flash8\]Bubbles script not working

**URL:** <https://forum.kirupa.com/t/flash8-bubbles-script-not-working/220230>\
**Category:** flash\
**Created:** [March 23, 2007, 9:16pm UTC](https://forum.kirupa.com/t/flash8-bubbles-script-not-working/220230 "2007-03-23T21:16:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DonQuijote](https://avatars.discourse-cdn.com/v4/letter/d/8e7dd6/32.png) [@DonQuijote](https://forum.kirupa.com/u/DonQuijote)\
**Post date:** [March 23, 2007, 9:16pm UTC](https://forum.kirupa.com/t/flash8-bubbles-script-not-working/220230/1 "2007-03-23T21:16:23Z")

</div>

Hello there!

I am creating a game with a colleague of mine, from the university, that takes place underwater.

I have the following code, which i took from [http://www.n99creations.com/?pID=user\_examples&col=Blue&eg=Bubble\_Cursor](http://www.n99creations.com/?pID=user_examples&col=Blue&eg=Bubble_Cursor) (thanx to the creator) and i tried to embody it into the code of the game we are creating:

```auto
onClipEvent (load) { 
_root.bubble._xscale=random(30) 
   _root.bubble._yscale=_root.bubble._xscale 
   bubblecount=0 
   xvelocity=Math.random()*2-Math.random()*2 
   yvelocity=1.02 
   _root.bubble._alpha=100; 
    
} 
 
onClipEvent (enterFrame) { 
   function bubbles() { 
      bubblename = "_root.bubble"+bubblecount; 
      _root.bubble.duplicateMovieClip(bubblename, bubblecount); 
      bubblecount++; 
   } 
    
   _root.bubble._x += xvelocity; 
   _root.bubble._y /= yvelocity; 
   _root.bubble_alpha--; 
   if (_root.bubble._alpha<1) { 
      _root.bubble.removeMovieClip(); 
   } 
   if (_root.bubble._y>400) { 
      _root.bubble.removeMovieClip(); 
   } 
   if (_root.bubble._y<0) { 
      _root.bubble.removeMovieClip(); 
   } 
   if (_root.bubble._x>550) { 
      _root.bubble.removeMovieClip(); 
   } 
   if (_root.bubble._x<0) { 
      _root.bubble.removeMovieClip(); 
   }

```

This code is inside the rest of the code, inside a single mc.

I have taken out the part with the mouse, because i want the bubbles to get out from random places at the bottom, inside the scene. Should i write a initial position?  
Although the example works, inside the game it doesn’t.

The “bubble” mc is inside the main scene. Only a single bubble is generated

Thanks in advance!
