I have an image gallery that is supposed to load an image pause on that image while loading the next and then fade out/fade in simultaneously. The script seems right to me except when it comes to which function is supposed to run mc_01up or mc_02up.
if (current == 1) {
mc_02_up();
} else {
mc_01_up();
}
Any help would be greatly appreciated.
-developmental
–Script–
//setup
delay = 3000;
filename = ["01.jpg", "02.jpg", "03.jpg"];
path1 = "http://130public.net/test_area/image_gallery/images/welcome/01/";
path2 = "http://130public.net/test_area/image_gallery/images/welcome/02/";
i = filename.length;
k = Math.floor(Math.random()*i);
//
mc_01.onEnterFrame = function() {
filesize = mc_01.getBytesTotal();
loaded = mc_01.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
}
};
//
function first_image() {
mc_01._alpha = 0;
mc_01.loadMovie(path1+filename[k], 0);
var current = 1;
if (loaded == filesize) {
fadein = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 100, 10, false);
slideshow();
}
}
//
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (current == 1) {
mc_02_up();
} else {
mc_01_up();
}
}
}
//
function mc_01_up() {
var current = 1;
var fadeListener:Object = new Object();
fadeListener.onMotionFinished = function() {
mc_02.loadMovie(path2+filename[k], 0);
mc_02.onLoad = slideshow();
};
fadein = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 100, 10, false);
fadeout = new mx.transitions.Tween(mc_02, "_alpha", null, this._alpha, 0, 10, false);
fadeout.addListener(fadeListener);
}
//
function mc_02_up() {
var current = 2;
var fadeListener:Object = new Object();
fadeListener.onMotionFinished = function() {
mc_01.loadMovie(path1+filename[k], 0);
mc_01.onLoad = slideshow();
};
fadein = new mx.transitions.Tween(mc_02, "_alpha", null, this._alpha, 100, 10, false);
fadeout = new mx.transitions.Tween(mc_01, "_alpha", null, this._alpha, 0, 10, false);
fadeout.addListener(fadeListener);
}
//
first_image();
stop();