# Random ordered array

**URL:** <https://forum.kirupa.com/t/random-ordered-array/175578>\
**Category:** flash\
**Created:** [January 16, 2006, 2:32am UTC](https://forum.kirupa.com/t/random-ordered-array/175578 "2006-01-16T02:32:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beekay1076](https://avatars.discourse-cdn.com/v4/letter/b/d2c977/32.png) [@beekay1076](https://forum.kirupa.com/u/beekay1076)\
**Post date:** [January 16, 2006, 2:32am UTC](https://forum.kirupa.com/t/random-ordered-array/175578/1 "2006-01-16T02:32:58Z")

</div>

Hi there,  
I’m creating a series of banners for a website. There are 3 so far with more to be made. I have made each banner as a separate swf file.

The thing I would like it to do it create a randomly ordered array of the banner swf names and then load the banners in that order. Once the banners have been played or loaded through, I would l simply like it repeat that same order again.

I have managed to create an array and play through that array in an ordered loop, but how do I create a random array that will do the same thing?

I’m not sure if I’m explaining things clear enough. If you need more clarification, please let me know.

Here’s the code I have in the container swf. The last frame of each of the banners calls the loadNewBanner() function.

clipNumber = 0;  
var Banner = new Array ();  
Banner[0] = “banner1.swf”;  
Banner[1] = “banner2.swf”;  
Banner[2] = “banner3.swf”;  
b = -1;  
//  
function loadNewBanner() {  
clipNumber++;  
if (b \>= 3) {  
b = 0;  
} else {  
b++;  
}  
bannerName = Banner\*\*;  
mc\_instance = “image\_mc”+clipNumber;  
this.createEmptyMovieClip(mc\_instance, this.getNextHighestDepth);  
loadMovie(bannerName, mc\_instance);  
trace("loaded “+bannerName+” into "+mc\_instance);  
}  
loadNewBanner();
