# Optimizing movies

As your movie file size increases, so does its download time and playback speed. You can take a number of steps to prepare your movie for optimal playback. As part of the publishing process, Flash automatically performs some optimization on movies: for example, it detects duplicate shapes on export and places them in the file only once, and it converts nested groups into single groups.

Before exporting a movie, you can optimize it further by using various strategies to reduce the file size. You can also compress a SWF file as you publish it. (See Publishing in Using Flash.) As you make changes, run your movie on a variety of different computers, operating systems, and Internet connections.

To optimize movies in general:

- Use symbols, animated or otherwise, for every element that appears more than once.
- Whenever possible, use tweened animations, which take up less file space than a series of keyframes.
- For animation sequences, use movie clips instead of graphic symbols.
- Limit the area of change in each keyframe; make the action take place in as small an area as possible.
- Avoid animating bitmap elements; use bitmap images as background or static elements.
- For sound, use MP3, the smallest sound format, whenever possible.

To optimize elements and lines:

- Group elements as much as possible.
- Use layers to separate elements that change over the course of the animation from those that do not.
- Use Modify > Curves > Optimize to minimize the number of separate lines that are used to describe shapes.
- Limit the number of special line types such as dashed, dotted, ragged, and so on. Solid lines require less memory. Lines created with the Pencil tool require less memory than brush strokes.

To optimize text and fonts:

- Limit the number of fonts and font styles. Use embedded fonts sparingly, because they increase file size.
- For Embed Fonts options, select only the characters needed instead of including the entire font.

To optimize colors:

- Use the Color menu in the symbol Property inspector to create many instances of a single symbol in different colors.
- Use the Color Mixer (Window > Color Mixer) to match the color palette of the movie to a browser-specific palette.
- Use gradients sparingly. Filling an area with gradient color requires about 50 bytes more than filling it with solid color.
- Use alpha transparency sparingly; it can slow playback.

To optimize ActionScript:

- Select Omit Trace Actions in the Flash tab of Publish Settings to leave `trace` actions out of a movie when it's published.
- Define functions for frequently repeated code. See Creating functions.
- Use local variables when possible. See About variables.