Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to preload external .swf elements? 1

Status
Not open for further replies.

prendo78

Technical User
Jan 15, 2002
2
GB
I've just looked through the preload archives and can't find anything that specifically answers my problem, or at least that I can understand.

I have a percentage preloader which calculates percentage loaded, bytes loaded and has a loadbar etc. It uses 2 scenes, the 1st scene is the preload code and the 2nd scene is the content.

I have 2 movies, the 1st is an intro and the second is my main site. The intro is just one movie (eg intro.swf) that is replaced by the 2nd (eg homepage.swf) after it ends.

The preloader works fine for the intro.swf but not for the homepage.swf. The main difference between the 2 movies is that the main site is just a blank one frame movie that loads in all the other elements, such as navigation & visual elements etc, as separate swf files.

I used the following preload code:

total_bytes = _root.getBytesTotal();
loaded_bytes = _root.getBytesLoaded();
remaining_bytes = total_bytes-loaded_bytes;
percent_done = int((loaded_bytes/total_bytes)*100);
bar.gotoAndStop(percent_done);
ifFrameLoaded ("Scene 2", 1) {
gotoAndPlay ("Scene 2", 1);
}

All that happens (when I test on the web)is that the preload bar flashes up for a second then a blank screen appears and the browser eventually crashes.

I'm not sure whether I need to add relative paths to each of the separate swf's that I'm trying to load in (there's about 8 in all).

Could someone tell me if this is what I need to do or if I'm missing something here.

Thanks for your patience.
 
Hi Prendo78!
Registered from yesterday's incident?

First, let me say the ifFrameLoaded action is deprecated in Flash 5, and that you should be using _framesloaded & _totalframes or the getBytesLoaded() & getBytesTotal() bit instead.

Preloaders, unless specificly scripted to do so, will allways oversee loadMovie actions... So your preloader for your intro movie isn't seeing that you're loading your homepage movie at the end of your intro movie, and simply doesn't take it into account. You should thus have a preloader on your homepage movie itself, if you want that one to be preloaded as well. Now if this homepage movie is basicly an empty holder frame movie in which you are again loading other movies, those movies won't, once again, be taken into account. So you should really add some basics elements such as navigation buttons in your homepage movie and only use the loadMovie actions to load other large items upon request from the user.
As I said, you can allways script your preloader to preload movies loaded with the loadMovie action, but the preloader will then take as much time to preload these movies, than if thoses movies were simply all included in your main movie.

Guess all of this might be a bit confusing!
You can allways e-mail me some of your .flas at oldnewbie@hotmail.com, I'll try to correct them to the best of my knowledge, and return them to you, so you can better visualize what I'm saying!

Regards,

new.gif
 
Thanks old newbie. I do have a separate preloader on the mainpage movie as well but I'm still not sure how to get round the issue of loading the external swf's.

I know that the LoadMovie command at the end of the intro is working because the 2nd preloader appears on screen(if only for a second).I'll have to send the fla as I'm still confused.

Thanks for your quick response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top