And this is what's on display frame.
I can't see any problem but there is absolutely one
Code:
stop();
trace(images);
// Display your images randomly here
var imageArray:Array = images; // Just grabs the array from frame 1 so you remember it's there
var numImages:Number = imageArray.length; // The number of valid images
var thisImage:String; // Property for the current image
var delayTime:Number = 3000; // The delay, in milliseconds that you want between image switches (1 sec = 1000 ms)
my_mcl.removeListener(clipListener1); // Gets rid of the checking actions
// Get an image to display
getNewImage();
// Gets a new image path from the array and call the function to display that image
function getNewImage(){
var newImgNum:Number = randRange(0, (numImages - 1)); // Get a random item number in the array
var newImage:String = imageArray[newImgNum]; // Get the image path from the array
if (newImage != thisImage){ // If it's not the same as what's displayed
displayImage(newImage); // Calls the function below
setTimeout(getNewImage, delayTime); // Calls this function again in a set amount of time
thisImage = newImage; // Sets the current image property
} else {
getNewImage(); // if the image called is the same as the one that's displayed, get a new one
}
}
// Displays the image
function displayImage(path:String){
check_mc._alpha = 100
trace("displayed " + thisImage);
// Your code here
}
// Gets a random number within a range
function randRange(min:Number, max:Number):Number {
var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
return randomNum;
}
Bookmarks