Nel primo frame scrivi:
codice:
// funzione muovi clip random
MovieClip.prototype.moveRandom = function(nomeClip, posX, posY, speed) {
this[nomeClip].onEnterFrame = function() {
with (this) {
_x += (posX-_x)/speed;
_y += (posY-_y)/speed;
}
};
};
livello = 1;
for (i=0; i<=30; i++) {
mc1.duplicateMovieClip("mc"+i, livello++);
mc = _root["mc"+i];
mc._x = random(Stage.width);
mc._y = random(Stage.height);
}
Nel secondo:
codice:
// chiamata funzione ogni 1 sec.
setInterval(function () {
moveRandom("mc"+i, random((areaX+areaLar)-mcLar), random((areaY+areaHal)-mcHal), 5);
}, 1000);