PDA

View Full Version : Preloader not working properly [Flash MX]



Tobili
December 6th, 2005, 07:42 AM
I'm using the preloader script from http://www.kirupa.com/developer/mx/percentagepreloader.htm but have come across a problem. The loader works fine when everything is in the movie from the start, jpegs are imported in the timeline and so on.

The thing is that I load a bunch of externally and other items from the library. In those cases the preloader doesn't run at all, the movie's just blank until everything is loaded and then it starts. It works ok, except for the preloader.

Anyone have a clue on this or an example of another script that works better?

PCGamre
December 6th, 2005, 11:51 AM
I hope you are loading external movies after the entire swf is loaded. If you are loading it while it's being loaded (say, on the second frame) I could see problems there. Just like with sounds (do you have many sounds in your movie?), I believe flash will have to load all attached items (such as sounds and MCs) first, in the first frame, then it'll load the other stuff, like stuff on stage, such as your preloader. That's why you don't see it b/c all the other stuff is getting loaded first into the first frame and by the time the preloader comes up, everything's (most) already loaded.

Try this: put a MC on stage in 4th frame on _root level. Name it something like "attachedMCsandSounds". Inside that MC, on SECOND frame (in individual layers), put all your sounds that are not on stage (ie, in frames) and all your MCs that will at some point be attached (but are not initially on stage). Make sure you put a stop action inside that MC on frame 1. In your Library, right click on all those MCs and sounds and click on LINKAGE. When the box pops up, uncheck the box that says "Export in first frame".

That way, all your MCs and sounds WILL be on stage and will not be exported from library into the first frame (which takes place first before you see anything else).

I believe that is your problem.

Tobili
December 6th, 2005, 01:24 PM
That solved my problem, thanks a lot! I don't have a lot of sounds but a bunch of different mc's with content.

So basically, instead of exporting all linked items to the first frame, you load them onto the stage "physically"? A bit of extra work but it does the trick.

PCGamre
December 6th, 2005, 03:22 PM
Awesome! Glad I could help.

Yeah, anything that is not loaded on the stage, but willl be loaded later (excluding external swfs, of course), needs to be in a frame somewhere or the preloader will get loaded secondary to those things.