I have the following code:
bubble_mc._visible = false;
var bubbleCount:Number = 40;
var vertMaxSpeed:Number = 10; // will be used in calculating maxiumum vertical speed for bubbles' movement
dupMovie = function () {
for (i=0; i<bubbleCount; i++) {
bubble_mc.duplicateMovieClip("bubble"+i+"_mc", i, {_x:Math.random()*bubble_mc._x, _y:Math.random()*bubble_mc._y, _visible:true});
with (eval("bubble"+i+"_mc")) {
_height = _width = Math.random()*bubble_mc._height;
}
}
};
dupMovie();
onEnterFrame = function() {
for(i=0; i<bubbleCount; i++) {
var randomSpeed:Number = Math.random() * vertMaxSpeed;
"bubble"+i+"_mc"._y += randomSpeed;
if ("bubble"+i+"_mc"._y < 28) {
delete "bubble"+i+"_mc";
bubble_mc.duplicateMovieClip("bubble"+i+"_mc", i, {_x:Math.random()*bubble_mc._x, _y:Math.random()*bubble_mc._y, _visible:true});
with (eval("bubble"+i+"_mc")) {
_height = _width = Math.random()*bubble_mc._height;
}
}
}
}
The problem is that Flash whines when I call
"bubble"+i+"_mc"._y += randomSpeed;
Because it won’t let me reference the duplicated movie clips that way… is there any other way to do this?