Link to home
Start Free TrialLog in
Avatar of skilleddesigner
skilleddesigner

asked on

How to load multiple swf file invisibly

i have around 50 swf files ,
example. main.swf,about.swf, services.swf, products.swf...... etc

main.swf is my 1st file which i embedded in index.html
by using actionscript 2.0 dynamically i am loading the external files ( which is about.swf, sevices.swf.. )
whenever i click a specific button it loads a specific swf file. which works perfectly fine with me.
but it gets really annoying each time i have to load the files and wait for the files to get loaded.
i wanted a javascript code which will load all my external swf files  invisibly in the cache of the browser while browsing the website. So that whenever i click a button its load instantly without  waiting to load again.

for further reference i have seen this kind of work in
http://www.pdk.com.pl/index_f.html
Avatar of CyanBlue
CyanBlue
Flag of United States of America image

So, it seems like you have posted your question to the wrong zone since you want the JavaScript solution...

It probably is annoying to wait for contents loading whenever you click on the menu items...  But it'll be more annoying to wait for everything to load in the beginning especially when you have 50 swfs to load...  That's worse user experience...  My 2 cents...  

CyanBlue
Avatar of skilleddesigner
skilleddesigner

ASKER

its not a once,
its loads one of the swf invisibly and then moves to next one.

Please check this website how they are doing it?
http://www.pdk.com.pl/index_f.html
one of my friend help with the following code but it seems not to be working fine,
any idea??

this.preloadCount=0;
this.numOfMovies=60;
 
//all the names of the swfs
this.movies_array=["info.swf", "about.swf", ..."number60.swf"];
function preloadMovies(){
    this.createEmptyMovieclip("myPreloadContainer_mc"+preloadCount, this.getNextHighestDepth());
    this["myPreloadContainer_mc"+preloadCount]._x = 5000;
    this["myPreloadContainer_mc"+preloadCount].loadMovie(this.movies_array[this.preloadCount]);
    checkLoad(this["myPreloadContainer_mc"+preloadCount]);
    
}
function checkLoad (myContainer){
 this.onEnterFrame = function() { 
        var total = myContainer.getBytesTotal(); 
        var loaded = myContainer.getBytesLoaded(); 
        if (loaded>200 && loaded>=total) { 
            delete this.onEnterFrame; 
    if(this.preloadCount < this.numOfMovies){
        this.preloadCount ++;
        preloadMovies();
    }
}  

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of blue-genie
blue-genie
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks