In order to render the first frame (the one that contains you animation)
that first frame of the swf has to be downloaded. If the first frame only
shows when 70% of the file is downloaded, it means that (roughly) 70% of the
swf size is in the first frame.

A very easy way to see this: when you export (ctrl + enter), press ctrl + B.
This will show you how the size of the swf is distributed among the frames
of the main timeline.

It could be a number of things. Maybe you have many assets exported in the
first frame, mabye your animation is too complex, and many other things.

There are 2 common ways to cope with this that I can think of now:

1) Make sure you keep your first frame lightweight, so it can be rendered as
fast as possible. Sometimes this is easy, sometimes it's a bit tricky.
Basically you'd have to remove all strictly unnecessary stuff from the first
frame and move it to other frame, uncheck "export for first frame" if you
have exported assets, etc. This could cause some problems if you don't plan
things a bit, like some parts that work when your swf is in your cache but
doesn't when you load it from a fresh cache.

2) Create a new swf that only contains the loading animation and the Loader.
If you manage to make it lightweight, it should load fast enough so the
"blank screen" is barely noticeable. So, in this option, you'd strip all the
loading animation and logic from your current swf, move it to a new one and
add a Loader to load your swf. If you have timeline stuff in the loaded swf,
put a stop on the first frame (and you could also leave it blank, but that
really depends on how you have lay out stuff). If you're using a document
class, you could add a method there so you can tell the loaded swf to "kick
off" from the loader swf (after it's been completely downloaded).

I personally like the second option better.

Juan Pablo Califano

2009/5/25 Isaac Alves <>

> Thanks Juan Pablo and Steven for the solution, it was very helpful!
> I'm struggling now with a weird problem:
> I've put an animation on frame 1 that keeps running in loop until the whole
> SWF file is loaded and the player moves to frame 2. Here is the code:
> trace (" hello ");
> addEventListener(Event.ENTER_FRAME, loading);
> function loading(event:Event) {
> var bytestotal=stage.loaderInfo.bytesTotal;
> var bytesloaded=stage.loaderInfo.bytesLoaded;
> trace(Math.round(bytesloaded*100/bytestotal)+"%");
> if (bytesloaded>=bytestotal) {
> removeChild(loaderAnimation);
> gotoAndStop(2);
> removeEventListener(Event.ENTER_FRAME, loading);
> }
> }
> stop();
> When I simulate download and play the program, the screen remains blank for
> some seconds, even though the file is already loading:
> The loading animation only appears on the screen (as well as the word
> "hello" is traced) when the file it's about 70% loaded, and then I see the
> percentage moving up in the Output panel.
> Why does it happens? The size of the file is 80kb. I've already tried
> putting this code into a different scene in the same swf file but the same
> thing happens. Someone has a clue?
> thanks a lot!
> Isaac
> _______________________________________________
> Flashcoders mailing list
Flashcoders mailing list

Reply via email to