So I’ve uploaded my slideshow swf to my WIP website (CSS files got overwritten ) Everything is working great. It’s looping, I have a preloader animation, ect. The problem I now want to resolve is getting the loader to cache the image files. When the slideshow is told to go back to image[0], it reloads it again. As the whole point of this project was to work around my free web hosting’s bandwidth limits, as well as getting more experience working with XML, this simply wont do. Imagine if someone browsing my site left the main page running for a few hours! What I need it to do is to somehow force the browser to cache the images once they are loaded, or at least I think this is what I need to do? Here’s the code again:
import fl.transitions.Tween;
import fl.transitions.easing.*;
import fl.transitions.TweenEvent;
var imageLoader:Loader;
var imgNum:int=0;
var xml:XML;
var rawImage:String;
var xmlList:XMLList
var xmlLoader:URLLoader = new URLLoader();
var numberOfChildren:Number;
var preLoaderChild = new preLoader();
preLoaderChild.x = 514;
preLoaderChild.y = 200;
preLoaderChild.scale
xmlLoader.load(new URLRequest("mainSlide.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
imageMaster_mc.addEventListener("movieClipDone", nextImage);
function xmlLoaded(event:Event):void
{
xml = XML(event.target.data);
numberOfChildren=xml.*.length();
packagedF(null);
}
function packagedF(event:Event):void
{
rawImage=xml.image[imgNum].imgURL;
imageLoader = new Loader();
imageLoader.load(new URLRequest(rawImage));
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, waitForLoad);
imageLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, imageLoading);
function imageLoading(evt:ProgressEvent):void
{
addChild(preLoaderChild);
}
function waitForLoad(event:Event):void
{
removeChild(preLoaderChild);
imageMaster_mc.imageMaster_anim.addChild(imageLoader);
imageMaster_mc.gotoAndPlay(2);
}
}
function nextImage(event:Event):void
{
if (imgNum < numberOfChildren-1)
{
imgNum++
packagedF(null);
}else
{
imgNum = 0;
packagedF(null);
}
}
And here is the work-in-progress website:
Thanks again in advance for any help!