# ActionScript (MX) How to clear cache(?)

**URL:** https://forum.kirupa.com/t/actionscript-mx-how-to-clear-cache/172965
**Category:** flash
**Created:** [December 19, 2005, 11:03pm UTC](https://forum.kirupa.com/t/actionscript-mx-how-to-clear-cache/172965 "2005-12-19T23:03:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![I3ear17](https://avatars.discourse-cdn.com/v4/letter/i/3e96dc/32.png) [@I3ear17](https://forum.kirupa.com/u/I3ear17)
#### Post date: [December 19, 2005, 11:03pm UTC](https://forum.kirupa.com/t/actionscript-mx-how-to-clear-cache/172965/1 "2005-12-19T23:03:59Z")

</div>

I am working on a slideshow based on the XML slideshow from this site. However, I have multiple slideshows, based on what the user selects. I have a problem however, when I try to change “views”. The old timer won’t reset, and the new view starts skipping images and the 6 sec delay is right out the window.

See what I mean here:

[Bestcon Site](http://www.bestconhomes.com/slide/bestconphotogallery.swf)

click Paradise Key then view 1, switch views to Pkey view 2, and back again to view one and the slideshow starts going crazy.

How do I reset this?

Here is my AS Code:

```auto
delay = 6000;
//-----------------------
function loadXML(loaded) {
	if (loaded) {
		xmlNode = this.firstChild;
		image = [];
		descr = [];
		var myArray:Array = Array("lakes", "key", "oaks", "preserve");
		logo.gotoAndStop(myArray[dev]);
		total = xmlNode.childNodes[dev].childNodes[ang].childNodes.length;
		for (i=0; i<total; i++) {
    		image* = xmlNode.childNodes[dev].childNodes[ang].childNodes*.childNodes[0].firstChild.nodeValue;
    		descr* = xmlNode.childNodes[dev].childNodes[ang].childNodes*.childNodes[1].firstChild.nodeValue;
		}
			firstImage();
	} else {
		content = "file not loaded!";
	}
}

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("bestconSlide.xml");

/////////////////////////////////////

//In case you want to use a key script to control slideshow
/*listen = new Object();
listen.onKeyDown = function() {
	if (Key.getCode() == Key.LEFT) {
		prevImage();
	} else if (Key.getCode() == Key.RIGHT) {
		nextImage();
	}
};*/

p = 0;
this.onEnterFrame = function() {
	filesize = picture.getBytesTotal();
	loaded = picture.getBytesLoaded();
	preloader._visible = true;
	if (loaded != filesize) {
		preloader.preload_bar._xscale = 100*loaded/filesize;
	} else {
		preloader._visible = false;
		if (picture._alpha<100) {
			picture._alpha += 10;
		}
	}
};
function nextImage() {
	if (p<(total-1)) {
		p++;
		if (loaded == filesize) {
			picture._alpha = 0;
			picture.loadMovie(image[p], 1);
			desc_txt.text = descr[p];
			picture_num();
			slideshow();
		}
	}
}
function prevImage() {
	if (p>0) {
		p--;
		picture._alpha = 0;
		picture.loadMovie(image[p], 1);
		desc_txt.text = descr[p];
		picture_num();
	}
}
function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		desc_txt.text = descr[0];
		picture_num();
		slideshow();
	}
}	
function picture_num() {
	current_pos = p+1;
	pos_txt.text = current_pos+" / "+total;
}
function slideshow() {
	myInterval = setInterval(pause_slideshow, delay);
	function pause_slideshow() {
		clearInterval(myInterval);
		if (p == (total-1)) {
			p = 0;
			firstImage();
		} else {
			nextImage();
		}
	}
}
stop();

```
