Solved

How to load multiple swf file invisibly

Posted on 2008-10-16
5
489 Views
Last Modified: 2013-11-11
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
0
Comment
Question by:skilleddesigner
  • 3
5 Comments
 
LVL 37

Expert Comment

by:CyanBlue
ID: 22735185
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
0
 
LVL 2

Author Comment

by:skilleddesigner
ID: 22735274
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
0
 
LVL 2

Author Comment

by:skilleddesigner
ID: 22756306
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

0
 
LVL 39

Accepted Solution

by:
blue-genie earned 500 total points
ID: 22758096
me again.
just because you're preloading everything "invisibly" doesn't mean that when I click the "products" link, the products swf is loaded.
you have 2 options.
1. one major preloader for all the content.
2. click and load on demand with preloader for the content. the good news, once loaded should be cached.

I'd suggest you have a look at the Loader class it shows you how to create listeners for when the items  are finished loading etc.
and there's code samples :-)
0
 
LVL 2

Author Closing Comment

by:skilleddesigner
ID: 31506908
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Change value in a Datagrid 1 38
Jquery height() issue 13 153
Google Chrome pepflashplayer.dll 8 124
Animating text  - electrons orbit around letter M 12 70
I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now