I have a dynamic image gallery that displays images that it pulls from xml. I have one movie clip, image_mc, that I load 1 image into at a time. Here’s the basics of my code:
var imageLoader:Loader = new Loader();
var currentSlideNum:Number = 0;
function loadImage(url:String):void {
imageLoader.unload();
imageLoader.load(new URLRequest(url));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
function imageLoaded(e:Event):void {
slide_mc.image_mc.addChild(imageLoader);
}
loadImage(mainList.photo[0]);
function changeSlide():void{
currentSlideNum ++;
loadImage(mainList.photo[currentSlideNum]);
}
My problem is, once I execute my changeSlide function and it loads an image that has already been loaded before, it seems to re-download the image again. The reason I think this is the case is because when I view my task manager properties, the memory usage for the web browser climbs up each time the function executes. It was my understanding that as long as the url for the image hasn’t changed that it should cache.
Does anyone have any idea what I’m doing wrong?