Random animations

I have 16 different animations in 16 different Movieclips in the Library.

I want them to play in a random order 1 after another from the library and exactly after all 16 play the loop should stop automatically.

I used array and have written the following “for” loop to play this.


var numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
var selectedNumbers = [];
var j = 1;
var i = 0;

for (var i = 1; i<16; i++) {
myvar = handle.createEmptyMovieClip(“mc”+i, i);
handle[“mc”+i].attachMovie(“movieclip”+i,“movieclip17”+i,i);
var index = random(numbers.length);
_root[“movieclip”+i].count.text = numbers[index];
trace(numbers[index]);
selectedNumbers.push(numbers[index]);
numbers.splice(index,1);
}


but when i play, all the 16 animations runs together without any interval.
Please can someone modify this script and suggest how to play only 1 animation at a time?
I am not sure how to place the “setInterval” function which i think will delay the loop each time.

Thanks in advance…