Bouncing_bubbles.fla this is the source code.

//allright people here it goes…          

var count = 0;          

//this is the variable that increments eachtime we add a
//new ball on the screen. Moreover we also decrement it everytime we remove a ball
//to keep the Array balls coherent otherwise we would get undefined values
//if we decide to remove some of the balls and then add others.          

var balls = new Array();        //this is the array that is going to keep the instance names of each ball on the stagevar speedx = new Array(); // this is the array that will contain the speeds on the X axis          

var speedy = new Array();       // same thing as the speedx  addBall function adds movieclips on the stage and also creates instance names for each added ball. All the instance name are in the balls Array;          

addBall.onRelease = function () {          

balls[count]=_root.attachMovie("Ball", "ball"+count,_root.getNextHighestDepth());          

        //the above line places each instance name into the array          

 balls[count]._x=20+Math.random()*400// these two lines place the movieclip on the stage at          

 balls[count]._y=20+Math.random()*200// the designated coordonates with randomnes.          

speedx[count] = Math.random() * 8;      //everytime a ball is created a speed value is assigned to it          

 speedy[count] = Math.random() * 8;          

color = new Color(balls[count]);          

 color.setRGB(Math.random()*0xFF0000+0×00FF00+0×0000FF);          

trace(balls);   // this traces the array          

 trace (count)// display that count value          

 speedx[balls.length-1].num = balls.length1;          

 speedy[balls.length-1].num = balls.length1;          

balls[balls.length-1].num = balls.length1;          

 // in the above line we add the .num property equal with count to use it to maintain the array coherent after adding/removing balls          

 balls[balls.length-1].onRelease = function(){          

 //this part gives each ball the functionality to be clicked and to be removed off the stage.
//Also the names from the array are going to be removed and kept synchronised.          

 for (i=this.num+1; i<balls.length;i++){></balls.length;i++){>          balls[i].num–;}//this sets the nums of the balls          

//in higher elements of the array. This part decrements the .num property to every element to the right
//of the clicked ball in the array. Example [1,2,3,4,5] if we click on 3 and remove it the
// elements to the right of it will have different position tags. so we have to change those.          

speedx.splice(this.num,1);      //this removes the value from the speedx array          

 speedy.splice(this.num,1);     // the same as for speedx          

 balls.splice(this.num,1);      // this line  removes the element from the array          

 this.removeMovieClip();                //this line removes the actual movieclip          

 trace(speedx)// I am doing a trace here to see if the array is clean          

trace(balls);   // traces the array balls          

        count–;        //decrements the counter to help keep the array synchronized after          

//we removed a ball from the array. because if we then decide to add the empty
//spots in the array will appear as undefined.          

        }          

trace(count);          

 trace(balls);          

 trace(balls[count].num);          

 speedx[count] = Math.random() * 8;          

 speedy[count] = Math.random() * 8;          

 realspeedx[count] = speedx[count];          

 realspeedy[count] = speedy[count];          

count++;// this increments the counter.. don’t be fulled about the count. You would          

 //think that it should not be decremented before we increment but this is about the scope.          

 // we decrement only when we click to remove a ball.          

}          

//———————Movement—————-          

var bounce = setInterval (movement, 30);// this interval calls the  the movement function by an interval of 30 miliseconds or so          

var moving:Boolean = true; // we need this value to test if the balls are moving or not          

stopBtn.onRelease = function(){          

if (moving) {                           //these four lines test to see if the starte of "moving" if it is false or not          

 stopBtn._alpha = 0;                    // tis guy sets the alpha(transparency to 0 to see the (start button after it moving has changed))          

 clearInterval(bounce);         // this stops the interval therefore stoping the moving          

 moving = false;                                // this is required because this is the property that about which we know if the balls are moving or not          

                                                        // it is also funny because we never actually test somehow to see if the balls change coordinates          

                                                        // we just test to seee if "moving" is false or true and then we just start or stop the interval          

                                                        //so this test is a work around. (this is a personal view )          

}          

 else {                                                                 //this is the else stament that set the motion back on          

 stopBtn._alpha = 100;                                  // this restores the stopButton back to being apaque          

 bounce = setInterval(movement, 30);          

 moving = true;          

}}          

function movement(){ // This function moves all my bubles on the screen. (movement is the function set in the "setInterval" by 30 miliseconds)          

for (count = 0; count<balls.length;></balls.length;>{          

 balls[count]._x+= speedx [count];          

 balls[count]._y+= speedy [count];          

if (balls[count]._x > 550-balls[count]._width/2 )       {          

        speedx[count] = speedx[count]*(-1);          

                                                                                                        }          

 if (balls[count]._y > 300-balls[count]._width/2 )      {          

        speedy[count] = speedy[count]*(-1);          

                                                                                                        }          

 if (balls[count]._x < (balls[count]._width/2)  )       {          

        speedx[count] = speedx[count]*(-1);          

                                                                                                        }          

 if (balls[count]._y < balls[count]._width/2)           {          

        speedy[count] = speedy[count]*(-1);          

                                                                                                        }          

for (i = 0; i<count;></count;>if (balls[i].hitTest(balls[count])) {          

color = new Color(balls[count]);          

color.setRGB(Math.random()*0xFF0000+0×00FF00+0×0000FF);          

color = new Color(balls[i]);          

color.setRGB(Math.random()*0xFF0000+0×00FF00+0×0000FF);}          

trace(balls[count]._x);          

trace(balls[count]._y);          

}}