Hello, I’m new around here. I was wondering if anyone could help solve my dilemma. I’m building a dynamic Grid Gallery in AS2 consisting of 35 image spaces with over a 100 images to select from. I want the images to be selected randomly, but don’t want any of the images to repeat. This is the code I have for the Randomnization.
I figured that if the imageNumber equaled itself then it would continue to randomize until it did not equal it self, but this is not the case. Thanks!
function loading_function(a:Number){
imageNumber = Math.floor(Math.random() * 100);
trace("this variable equals..." + a);
var myLoader:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadStart = function(){
trace("this box has started loading");
}
myListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number){
percent = Math.floor(bytesLoaded/bytesTotal * 100);
}
myListener.onLoadError = function(target:MovieClip){
eval("box" + a);
}
myListener.onLoadInit = function(target:MovieClip){
trace("successfully loaded");
eval("box" + a);
}
myLoader.addListener(myListener);
myLoader.loadClip("thumbs/thumb" + imageNumber +".jpg", "box" + a + ".targetBox");
if(imageNumber == imageNumber){
imageNumber = Math.floor(Math.random() * 99) + 1;
} else {
imageNumber = imageNumber;
}
}