Code:
var balloons:Array = new Array("red2", "re_wo", "red_we", "red_to", "red_su", "red_shi", "red_sa", "red_ru", "red_ri", "red_ra", "red_o", "red_ni", "red_na", "red_mi", "red_ku", "red_ko", "red_i", "red_fu", "purple_yu", "purple_wa", "purple_no", "purple_ne", "purple_mo", "purple_ka", "purple_he", "purple_a", "purple", "orange_yo", "orange_wi", "orange_u", "orange_tsu", "orange_te", "orange-se", "orange_me", "orange_ma", "orange_kyo", "orange_ho", "orange_ha", "orange", "blue_ya", "blue_ta", "blue_so", "blue_ro", "blue_nu", "blue_mu", "blue_ki", "blue_hi", "blue_e", "blue_chi");
var counter:Number = 0;
var moveBalloons:Array = new Array();
var distanceMoved=3;//this is distance all the balloons move 1 is slow and 5 is fast
//this function will move the balloons down
hitBackground.onEnterFrame= function(){
//this moves the balloons
for(var i=0;i<moveBalloons.length;i++){
_root[moveBalloons[i]]._y+=distanceMoved;
}
//this removes the movieclips when they get to a certain y position
if(_root[moveBalloons[i]]._y>400){
//trace('kill this one');
_root[moveBalloons[i]].removeMovieClip();
}
}
//this function makes a new balloon every 2.3 seconds
setInterval(makeBalloon,2300);
//this function creates a random balloon
function makeBalloon(){
randomNum= random(balloons.length);
newBalloon = balloons[randomNum];
_root.attachMovie(newBalloon,"object"+counter,_root.getNextHighestDepth(),{_x:60+Math.random()*600,_y:50});
moveBalloons.push("object"+counter);
counter++
}
makeBalloon();
/*hitBackground.onEnterFrame = function(){
if ( hitBackground.hitTest(balloons) ){
balloons._alpha = 100;
} else {
balloons_alpha = 0;
}
}
*/
/*hitBackground.onPress = function(){
counter = counter + 1;
if (counter > 0){
var balloonstween1:Tween = new Tween(balloons, "_x", mx.transitions.easing.Regular.easeIn, random(6), false);
balloonstween2.onMotionFinished = function(){
attachMovie(balloons[counter],"object"+counter);
}
}
}*/