Hello All !
I have an Array Randomly loading images on to the stage, there is a ‘splice’
so no 2 images repeat. the problem is - once the images all get ‘deleted’ there are
no more images the array can pull. I want the images to be recreated in the array.
That way It will load the 29 images I have Randomly, with out repeating them
and after all 29 appear it will start over again.
If I remove the ‘splice’ I can load as many images as I want however some load twice
or more before the batch is complete.
var images:Array = new Array();
for (var i:Number = 0; i < 29; i++) {
images.push("image" + i + ".jpg");
}
images[0]="image0.jpg";
images[1]="image1.jpg";
images[2]="image2.jpg";
images[3]="image3.jpg";
images[4]="image4.jpg";
images[5]="image5.jpg";
images[6]="image6.jpg";
images[7]="image7.jpg";
images[8]="image8.jpg";
images[9]="image9.jpg";
images[10]="image10.jpg";
images[11]="image11.jpg";
images[12]="image12.jpg";
images[13]="image13.jpg";
images[14]="image14.jpg";
images[15]="image15.jpg";
images[16]="image16.jpg";
images[17]="image17.jpg";
images[18]="image18.jpg";
images[19]="image19.jpg";
images[20]="image20.jpg";
images[21]="image21.jpg";
images[22]="image22.jpg";
images[23]="image23.jpg";
images[24]="image24.jpg";
images[25]="image25.jpg";
images[26]="image26.jpg";
images[27]="image27.jpg";
images[28]="image28.jpg";
var picture:MovieClip = this.createEmptyMovieClip("picture",1);
picture._x = -167;
picture._y = 86;
btnRand.onPress = function() {
var num:Number = Math.floor(Math.random() * images.length);
picture.loadMovie(images[num]);
images.splice(num, 1);
};