flash actionscript:
I'm trying to make multiple movies show through a main file in sequence
(slide0.swf, slide1.swf, slide2.swf etc etc).
I've been using some fla document that was sent to me to do such a thing but
somehow I can't get things to work exactly as intended.
My main file/movie uses these pieces of actionscript to do the loading of the
sequential files/movies
(Frame 1)
//initialize
var delay:Number = 5;
var numImages:Number = 3;
delay=delay*1000;
// Randomize array
Array.prototype.shuffle = function() {
var len = this.length;
var temp, rand;
for (var i = 0; i<len; i++) {
rand = Math.floor(Math.random()*len);
//swap current index with a random one
temp = this[i];
this[i] = this[rand];
this[rand] = temp;
}
};
var list:Array = new Array();
var buildArray:Function = function (len:Number) {
for (var i = 0; i<len; i++) {
_root.list.push("./SPW/slide"+i+".swf");
}
_root.list.shuffle();
_root.list.shuffle();
};
buildArray(numImages);
//IDX Watcher
var IDX = "";
function changeIDX(prop, oldVal, newVal) {
if (oldVal != newVal) {trace(list[newVal]);
loadme.loadClip(_root.list[newVal], _root.top);
return newVal;
} else {
return oldVal;
}
}
function addIDX(){
_root.IDX=(_root.IDX+1)%_root.numImages;
}
//MovieClip Loader
var loadme:MovieClipLoader = new MovieClipLoader();
var loadbtm:MovieClipLoader = new MovieClipLoader();
var listen:Object = new Object();
listen.onLoadInit = function(mc:MovieClip) {
mc.play();
_root.myInterval=setInterval(doInterval,delay);
};
listen.onLoadComplete = function(mc:MovieClip) {
loadbtm.loadClip(list[(IDX+1)%numImages],_root.btm);
};
var doInterval:Function = function(){
_root.top.play();
clearInterval(myInterval);
}
loadme.addListener(listen);
_root.watch("IDX",changeIDX);
(Frame 2)
IDX=0;
(Frame 8)
setInterval
stop();
__________________________________________
Now if I do not add anything to my other clips, the main file just keeps
looping the first one over and over rather than going up through them all
sequentialy. So I tried addind this in the last frame of each of the
movies/clips to be displayed
(Last Frame)
_root.addIDX();
___________________________________
The problem I now have is that although now the movies are playing one after
the other sequentialy I still get a small amount of repeat (fraction of a
second) of the movie that just played before the newly loaded one displays.
Is there a way that I can make this transition work smoothly rather than have
a jerky moment of flashback before each new movie in the sequence starts
playing?
Thanks