I have 9 movie clips which I want to load in random order, so that viewers who come to the webpage don't always see the same thing. I have them set up as 9 frames within another mc.
I'm no Actionscript expert (far from it) but I found a script on one of these forums (it's from a very old thread though) that does just what I need EXCEPT it always displays the first one first, and then the rest in random order. I tried making the first frame empty, but then there was a big lag before it showed anything, because of the timer. Any suggestions, or perhaps a different way altogether? Here's the script I used:
myMc.stop();
time = getTimer();
wait = 500;//1000ms = 1 second
_root.onEnterFrame = function(){
if (getTimer() > time+2000){
myMc.gotoAndStop(random(myMc._framesloaded)+1);
time = getTimer();
}
}
Thanks but - this does exactly the same thing! Always starts by showing frame 1 of the movie clip.
Any other ideas?
By the way, each of the movie clips within my main mc are 100 frames long. I changed the time to 9000, to give me the time I need for each one.
I'm not sure what this line does:
wait = 500;//1000ms = 1 second
When I commented it out, it made no difference.
I'm fine with the pacing and yes, 9000 seems about right, no problem there.
The problem is that when the script runs, we're already seeing frame #1 of the mc. I want the order of the whole sequence to be random, starting with the first frame we see. Should the script be on a different frame than the mc?
Here's the fla. I swapped out differently-colored number sequences for the photos, for smaller file size. The first set of numbers is white. How can I change it so that it's random?
stop();
var time = getTimer();
var myMC_h = 22;
var wait = 9000;//1000ms = 1 second
myMC._visible = false;
do {
myMC.gotoAndStop(random(myMC._framesloaded)+1);
} while (myMC._framesloaded<myMC._totalframes);
myMC._visible = true;
_root.onEnterFrame = checkUpdate;
function checkUpdate() {
if (getTimer()>time+wait) {
myMC.gotoAndStop(random(myMC._framesloaded)+1);
for (i=0; i<9; i++) {
this["myMC"+i].removeMovieClip();
this.attachMovie("myMC","myMC"+i,this.getNextHighestDepth(),{_x:100, _y:100+this._y+myMC_h*i});
this["myMC"+i].gotoAndStop(random(10)+1);
}
time = getTimer();
}
}