This site is now just an archive over the rise and fall of Flash. The domain is available for sale
Login | Register

Optimizing filesize - Make your files smaller

When working with Flash, filesizes may "come and go". Here's a list of solutions if you want your project to be perfect "SizeWise".

28. AUGUST 2000, Jens Chr. Brynildsen 1. Scenes does not "exist"
Many people use Scenes within Flash to gain a better overview. You should be aware of that Scenes is actually nothing but an ordinary "label" within Flash. If you use Scenes, Flash will add extra Kb to your file size for every new layer. Even if you name the Layer the same as it was called in the previous scene, Flash will actually create new layers each time you add a scene with more layers. If you avoid using scenes, you can save considerable kilobytes on the total file size.

2. Smart loading of movies
Flash 3 introduced the possibility of loading separate SWF-files into "Levels" above the main movie. Flash 4 continued this by letting you load these into other MovieClips and Flash 5 has taken this even further. This may seem like a smart way of downloading, as the user only loads parts at a time. This is partially true, but it can also add a considerable amount to the kilobytes downloaded by the viewer.

Let's use a simple example. Create a new file that contains nothing but a text-field. Check the button that "includes all font outlines". Test the movie and use the bandwidth profiler to inspect the file-size. For Times New Roman, this will mean 27Kb of just fonts! If you use a more realistic comparison, and only include numbers, upper and lower capped letters, this will still be more than 8Kb.

As you can see from this example, every new swf-file will use a lot of Kb, just to describe the font. If you load a lot of external SWF's, this number will increase accordingly. We have seen sites that have been more than double of the necessary file size, so if you can manage to cram everything into one SWF-file, this will save the viewer a lot of time.

3. Tracing images
Make sure you hand-optimise all traced images. There are lots to be gained from selecting only the parts that can be optimised without loosing the original shape. Always use "multiple passes" even though it's slower. If the image contains large, coloured backgrounds, put them on a separate layer and convert them to ordinary squares to save some bytes.

4. Edit your sounds before you bring them into Flash
When you export sounds in Flash, you have the option not to use the whole sound. Flash will still add the full file to your SWF. Due to this, make sure that you crop your sound files as much as possible before importing them into Flash.

5. In general
While working on a project, make sure you always think before you add stuff. Think through the following:

- Is this a necessary feature, or will it just increase the file size. It's always cool to have many sounds, but will the user even care if the unnecessary kilobytes take too long to download?
- Could you maybe re-use another symbol with a tint-effect instead?
- Maybe you could use a small fragment of a loop that's already loaded as a sound for mouse-clicks. Try adding some loops and a fade.
- Could you save lot's of coding by creating a function or a subroutine (call-command)?
- Can the code be written more efficiently?
- Could you duplicate a MovieClip and set some variables instead of making many clips?


About Jens C Brynildsen

Jens has been working with Flash since version 3 came out. Since then, he's been an active member of the Flash community. He's created more than a hundred Flash games (thus the name of his blog) but he also creates web/standalone applications, does workshops and other consulting. He loves playing with new technology and he is convinced that the moment you stop learning you die (creatively speaking). Jens is also the Editor of this website.

Get new stories first

Click to follow us on Twitter!



No comments for this page.

Submit a comment

Only registered members can comment. Click here to login or here to register