Jump to content
Search Community

PreLoad Browser Cache?

pol test
Moderator Tag

Recommended Posts

Hi -

 

Anyone know of a nifty way to preLoad the browser Cache?

 

I have 3 SWfs which I will load and unload into movieclips as needed (for good memory management). But, I'd love to preload the browser cache (not my main movie) with all 3 so that when I do load them, they load quickly.

 

Does that make sense?

 

Thanks,

Pol

Link to comment
Share on other sites

When you say "preload the browser cache", I assume you mean that you just want to get the files into the cache and dump them from the Flash Player's memory, right? If so, that should be pretty easy - just dispose(true) each of your loaders after they complete. Kinda like this:

 

LoaderMax.activate([sWFLoader, ImageLoader]);
var files:Array = ["1.swf","2.swf","image.jpg"];

var queue:LoaderMax = LoaderMax.parse(files, {autoDispose:true, onChildComplete:childCompleteHandler});
queue.load();

function childCompleteHandler(event:LoaderEvent):void {
   event.target.dispose(true);
}

Link to comment
Share on other sites

  • 1 month later...

I'm looking to do something similar, but a little different :)

 

I have an application that is loading in SWF's as "slides" through an XMLLoader. Each slide can contain whatever, but usually contains video or audio. With 30+ slides to load I'd like to keep the preloading going, but then immediately unload the file so it's not ballooning the memory footprint of the entire application. I'd prefer not to use your dispose method since I rely on calling the loaders named in the XMLloader elsewhere in the application.

 

I was trying to load the list of slides in the XMLLoader with load="false" and then build a for each loop that would load each individual SWFLoader and then onComplete unload() it. But this is where I've been defeated. I'd appreciate any code examples or suggestions on a better way to do this.

 

Here is my slides.xml setup

 



Example name 1



Example name 1



 

I don't have much for AS3 code that's working, but I'll give you a place to start

 

private function loadSlides ():void {
     var loader:XMLLoader = new XMLLoader("slides.xml",{onComplete:loadNDump});
     loader.load();
}
private function loadNDump (e:LoaderEvent):void {
       //extract the SWFLoaders from slides.xml
      //load() and then unload() them
}

 

Many thanks in advance,

Jaysin

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...