PDA

View Full Version : preloader script


jenwhitie
11-26-2003, 02:06 PM
I have an external .swf that I am loading in to an empty movie clip in another movie. The empty clip is on the root time line of the main movie and it has an instance name of emptyClip

The external .swf is a really big one, and it requires a preloader. I think that I am getting mixed up with the path. This is what I have:

onClipEvent (enterFrame) {
loading = __root.emptyClip.getBytesLoaded();
total = _root.emptyClip.getBytesTotal();
percent -= (percent-((loading/total)*100))*.25;
per = int(percent);
percentage = per+"%";
loadBar._width = per;
if (percent>99) {
_root.emptyClip.gotoAndPlay(2);
}
}
you can check out what happens @ www.warrensmusic.com

Henke
11-26-2003, 03:04 PM
It worked just fine for me... What the problem:confused:

The preloader loads and then shows the swf

jenwhitie
11-26-2003, 03:06 PM
I forgot to specify that it is the listen link that has the problem...

binkyboo
11-26-2003, 03:16 PM
Looking at it briefly I noticed:

loading = __root.emptyClip.getBytesLoaded();

it should be:

loading = _root.emptyClip.getBytesLoaded();

jenwhitie
11-26-2003, 03:18 PM
ohhhhh,
Why is it that you can be so blind sometimes????
Thanks

binkyboo
11-26-2003, 03:18 PM
Did that do the trick?

jenwhitie
11-26-2003, 03:21 PM
It will take about 15min to publish, I will let you know..
Thanks

jenwhitie
11-26-2003, 03:46 PM
It still isn't really working. When you press on the button, the preloader doesn't come up. I think that it isn't really targeting the right stuff to preload.

www.warrensmusic.com

click on listen, and wait 10 sec or so...

binkyboo
11-26-2003, 03:49 PM
could you strip out the graphics and post the two flas?

jenwhitie
11-26-2003, 07:24 PM
I figured out the problem.

I was watching the bandwith profilier, and couldn't understand why there was so much in the first frame, when all I had there was a perloader. Then I realized that I have sound in the file that I need to preload. The sound is linked to the timeline through actionscript. When I set up the linkage, I said export on the first frame. If I uncheck that box, it won't export at all. How can I make this file preload?

divarch
11-27-2003, 03:35 AM
Hi,
it's the same thing as having a movie attached.

Say your preloader is in frame1 in the main,
your content is in frame 3, and you put all (not-exported in 1st frame) files from the library in the frame 2.

That way they get preloaded, but using the script you must jump over the 2nd frame.

Hope this helps .

jenwhitie
11-28-2003, 01:03 PM
do you mean just drag the instances of the sound on to the stage in frame 2?

divarch
11-28-2003, 04:29 PM
Originally posted by jenwhitie
do you mean just drag the instances of the sound on to the stage in frame 2?

No, you can include sound wherever you want, just don't export it in first frame.

Search some, there's a tutorial with a .fla about it, I just can't remember, but that is basically it.

Cheers