Preloading images - Automated slideshow

Hi, can anyone help me here. I’ve created a slideshow that runs off a setInterval. Basically I just want the next jpg in the array to load whilst the current slide is on the screen for the specified interval.

///I also tried using this piece of code:
_root.slideTween_mc.t1_mc.loadMovie (pathToPics + counter + “.jpg” || + “.swf”, 20);
//not sure why this doesn’t work. Any ideas?

//Here’s the code
///////////////////////
<code>
_global.counter = 1;
_global.pathToPics = “HTemplates/”;
//AUTOMATED SLIDESSHOW//PT1
automated_btn.toggled = true;
automated_btn.onRelease = function(){
if (this.toggled) {
trace(toggleActive)
timer = setInterval(auto, 2500);
} else {
trace(untoggled)
clearInterval(timer);
}
}
//AUTOMATED SLIDESSHOW PT2
function auto(){
this.toggled = false;
if (this.toggled) {
_root.slideTween_mc.gotoAndPlay(“next”);
} else {
_root.slideTween_mc.gotoAndPlay(“nexit”);
//
if (counter < 20) {
counter ++;
} else {
counter -= 19;
}
}
}
//Next pic //It would be recommended to use a preloader before the animation can run!!
function changePic(){
_root.slideTween_mc.t1_mc.loadMovie (pathToPics + counter + “.jpg” || + “.swf”, 20);
//indicate the number of the slide
screenCounter_txt.text = counter;
}
</code>