Kirupa XML Slideshow- clearInterval NOT work

Hi All.

The slideShow function of the xml photogallery does’nt work very well. seems the clearInterval does’nt clear myInterval properly.
Been going through the forums to find an answer to this problem, with no real luck. I’m sure somebody else must have had the same issue

I’ve made some changes to the gallery : Mainly using MovieClipLoader and TransitionManager.


import mx.transitions.*;
import mx.transitions.easing.*;
// *****************************************
// SLIDE ENGINE 
// *****************************************
initShow = function () {
	trace('initShow Called...');
	clearInterval(_global.myInterval);
	delete _global.slideInterval;
	//trace('_global.slideInterval: '+ _global.slideInterval);
	delay = 5000;
	p = 0;
	total = slide.images.length;
	
	trans_type = Blinds;
	// Dimension (0=Horisontal,1=Vertical)
	dim = 0;
	// Duration (Number of Secs)
	dur = 1;
	// StartPoint (phone-pad 1-9)
	start_point = 3;
	// Shape ("CIRCLE","SQUARE")
	trans_shape = "CIRCLE";
	// Shape (CIRCLE,SQUARE)
	num_strips = 20;
	// xSections & ySections
	x_sections = 30;
	y_sections = 20;
	//trace('total: '+total);
	firstImage();
};
//**************************************
// MovieClipLoader & Listener
var mcl_listener:Object = new Object();
mcl_listener.onLoadProgress = function(target_mc:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
	percent_txt.text = "Loading:	  "+Math.floor((bytesLoaded/bytesTotal)*100)+" %";
};
mcl_listener.onLoadInit = function(target_mc:MovieClip) {
	loadanim_mc.removeMovieClip();
	percent_txt._visible = false;
	var myListener:Object = new Object();
	myListener.allTransitionsInDone = function() {
		if (lang == "fr") {
			txt_mc.txt.text = slide.captions_fr[p];
		} else {
			txt_mc.txt.text = slide.captions_en[p];
		}
		txt_mc._visible = true;
		//new Tween(txt_mc, "_alpha", Regular.easeIn, 0, 100, 1.5, true);
		//new Tween(txt_mc, "_y", Regular.easeIn, 240, 233, 1, true);
		if (total>1) {
			// IF MORE THAN ONE IMAGE START SLIDESHOW
			pictureNum();
			killImage();
			slideShow();
		}
	};
	var myTM:TransitionManager = new TransitionManager(target_mc);
	myTM.addEventListener("allTransitionsInDone", myListener);
	var transParams:Object = new Object({type:trans_type, direction:0, duration:dur, shape:trans_shape, startPoint:start_point, xSections:x_sections, ySections:y_sections, dimension:dim, easing:easing.Strong.easeOut, numStrips:num_strips});
	txt_mc._visible = false;
	myTM.startTransition(transParams);
};
var my_mcl:MovieClipLoader = new MovieClipLoader();
my_mcl.addListener(mcl_listener);
// ****************************
// ****************************
// FUNCTIONS
firstImage = function() {
	my_mcl.loadClip(slide.images[0], container.createEmptyMovieClip("pic"+0, container.getNextHighestDepth()));
}
nextImage = function() {
	if (p<(total-1)) {
		p++;
		my_mcl.loadClip(slide.images[p], container.createEmptyMovieClip("pic"+p, container.getNextHighestDepth()));
	}
}
pictureNum = function() {
	current_pos = p+1;
	num_txt.text = current_pos+" / "+total;
}
killImage = function() {
	if (p == 0) {
		old_mc = "pic"+(total-1);
	} else {
		old_mc = "pic"+(p-1);
	}
	container[old_mc].removeMovieClip();
}
slideShow = function() {	
	clearInterval(_global.myInterval); 	// This is to make sure it's cleared before
	delete _global.myInterval; 		// starting the slide show 
	_global.myInterval = setInterval(pauseSlideshow, delay);
	function pauseSlideshow() {
		clearInterval(_global.myInterval);
		trace('slideInt:'+ _global.myInterval);	// starts at 3 and increments by 1 per cycle	
		delete _global.myInterval;
		trace('slideInterval:'+ myInterval);	// undefined each time as expected
		//
		if (p == (total-1)) {
			p = 0;
			firstImage();
		} else {
			//trace(p);
			nextImage();
		}
	}
}

stopShow = function() {
	trace('stopShow called....');
	clearInterval(_global.myInterval);
	delete _global.myInterval;
	//trace('_global.slideInterval;:'+this._global.slideInterval;);
	slide.images = [];
}
//initShow();

This code sits in a MC on the stage and is re-used throughout the site using the initShow() function.

Any help greatly appreciated!
.henkedo