Preload external swf hell

Okay, if ANYONE decided to write an easy to understand, comprehensive tutorial on preloading external swf files, they could easily become the HERO of this wonderful website.
(Or at the very least MY own personal hero)

I have searched and read and tinkered and finally screamed!!!

There are MANY threads on this topic but it seems like everyone just throws around code and writes stuff like “just swap _root for _parent and you’re set”. That may be fine for some people who are a step away but what about a logical, laymans EXPLINATION of the PROCESS?
like…
Where do you place the preloader bar?
Where do you attach the code?
Where do you load the swf?

Anyone please,… this is a very confusing problem that many of us intermediates are struggling with. I love this site and all the help I get from may of the users. But this is a subject that needs great clarification and would love to see someone step up and deliver.

Thank you!

try the create a full flash site tutorial

http://www.kirupa.com/developer/mx/full_site.htm

Once completed, you will understand how to load external movies.

as for the .root .parent take a look at these threads

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=20828&highlight=root

http://www.kirupaforum.com/forums/showthread.php?s=&threadid=20931&highlight=root

TD

Check my example of preloading external files.
You can also download the file there. Any feedbackl will be apreciated.

http://www.geocities.com/claudiodj

Cheers =)

Okay, first of all TobyDog, thanks but… the kirupa complete site tutorial does not mention ANYTHING about PRELOADING external swfs. Loading files is a snap, figuring out how to preload them a bit tougher.

… until I deconstructed Cladios source files!

Finally, the concept is clear to me!!! And by the way, for all of you who advised putting a preloader in the external swf, this is not an option if your swf was created with Flix or if its a .jpg.

For those who may still be struggling, try this out:

The main timeline should contain 2 movie clips. One that acts like a container into which the swf will be loaded, and a second movie clip that will act as the preloader. Best to think of it as a buffer or “mask” of sorts that appears before the swf actually appears.

Container MC Claudio used had the following script attached (I simplified it slightly):

//
onClipEvent(enterFrame) {
if(this.getbytesLoaded()==this.getBytesTotal)) {
_root.preload.gotoAndStop(2);
}
}

This checks to see if the movie is loaded and then tells the second movie clip (Preload) gotoAndStop at frame 2.

The Preload MC I made has 2 frames, but yours can have more. The 1st frame should have whatever you want the user to see BEFORE THE MOVIE LOADS. For instance: “LOADING…” or whatever graphic you may want. The second or subsequent frames should be blank. Then add this script to the 1st frame:

//
_root.external_movie = “myMovie.swf”;
loadMovie(_root.external_movie, _root.container);
stop();

This tells your swf (initiated as ‘external_movie’) to load in the Container MC on the main timeline. When its finished (as determined by the script in Container MC) the playhead in Preload MC moves to frame 2 which clears the way for the user to see the external swf!

Thats it.

Anyone who feels they can improve on this, please feel free to add on.

And many thanks to Claudio!

But wheres your load bar!?! Always have a load bar i tell that to everyone. No one wants to just see ‘Loading’ and not know how long they’ll have to wait. You’ll lose business if your a business or you’ll just lose vistors to your site. Think of the 56k users out there (though i’m not one).

I will write a tutorial about how to make a basic but effect preloader for an external .swf with a loadbar.

Viru

You’re welcome Pspecial :slight_smile:
Lots of ppl were asking how to prelaod external files so i created dat example. I already emailed Kirupa, since im trying to make a tutorial for dat.

And KO2n, i didnt put a loadbar because i didnt feel like. It was just a simple example to show how the concept.

I was only giving pspecial a tip.

Viru.

OK
=)

kO2n I would greatly appreciate if you wrote a tut to this. I´m not
a newbie but I haven´t been able to get my head around this, and belive me I´ve put in alot of hours with only semi-functioning solutions.

I made a tutorial for my example, just sent it to Kirupa.

Does anyone know why my preloader might not work on a dial-up connection? Seems strange but the same script I got to work as a reuslt of this forum does not work when access my site using a slow connection. I can hear the movie running in the background but the preloader remains visible.