Swap loader thing

I want to use a next/previous image thing, which loads the next image from an array into a second movieclip(which will be hidden)… then swap the visiblity of mc_1 and mc_2 …attach a preloader and stuff.

its basically an effort to save some peoples asses on 56K dial-up lines.

so it alternates between mc_1 and mc_2 (which is the easy bit)


picPath = "";	   
pics = ['winterrangep1.jpg', 'winterrangep2.jpg', 'winterrangep3.jpg', 'winterrangep4.jpg', 'winterrangep5.jpg', 'winterrangep6.jpg'];

_root.createEmptyMovieClip("myMovieClip", 1);
var mc_1 = _root.myMovieClip.createEmptyMovieClip("imageHolder", 1);
var mc_2 = _root.myMovieClip.createEmptyMovieClip("imageHolder1", 2);
mc_1.picNumber = -1;
mc_2.picNumber = 0;
mc_2._x = 500;

// Load the next image in the array
MovieClip.prototype.loadNextPic = function(i){
    // this gets the next image number, looping around at the end
	this.picNumber = (this.picNumber +i) % _root.pics.length;
	trace(this);
	// load in the image
	this.loadMovie(picPath + _root.pics[this.picNumber]);
	// and start checking to see if it's done loading
}
mc_1.loadNextPic(1);
mc_2.loadNextPic(1);
_root.box.onRelease = function(){
	mc_1.loadNextPic(1);
	mc_2.loadNextPic(1);
};

this code works, although when I rerun the function by clicking on “box” it just loads the image at pic[0] (winterrangep1.jpg)
while tracing this.picNumber in the loadNextNumber function I get NaN.

That only becomes NaN when _root.box is clicked, not when it is run from the _root.

I can’t work out why?
Any ideas? :slight_smile: