AS Reference  :  Notes Index  :  Resources  :  About/Contact  :  Downloads

Optimizing Image and Sound Compression for Size/Quality

Changing the compression of all imported jpgs

When you import a bitmap graphic into Flash, it will by default be exported at Flash's default compression (jpgs, bmps) or without any compression (gifs, pngs). If you want to change the compression for all jpgs and bmps that have been imported, you can do so by choosing File, Publish Settings and looking in the Flash tab. You'll see a slider bar for Jpeg Quality, which is set by default to 80. Move the slider to change the compression of all jpg/bmp images in the file. Republish to see how movie size and image quality have been affected.

Changing the compression of individual images

To change the compression for a particular jpg or bmp graphic, you can right-click on it in the library, choose Properties

and set the compression to one of the following (from Flash Help file): Use Photo compression for images with complex color or tonal variations, such as photographs or images with gradient fills. Use Lossless compression for images with simple shapes and relatively few colors.

Try importing background.jpg from the class folder, publishing and looking at the file size of the published swf. Then go back into the fla, change the bitmap's compression to something lower (eg, 50), publish with a different output name and look at the new file size (and the picture quality) for comparison.

Obviously, you should always start with the best quality image you can obtain for the particular dimensions you need to get the best final picture. You can always increase the compression to make the file size of the swf smaller, but you can never reduce the compression beyond that of the imported picture to make it better.

Changing the compression of imported sound

The compression of sound files which are imported into Flash and set to Stream (as opposed to Event) sounds is set in the Audio Stream setting in the Flash tab of the Publish Settings screen. Normally, you will only have one Stream file playing at a time, so that is what will be affected when you change the Audio Stream setting. The higher the bitrate, the better the sound and the bigger the filesize. You can't raise the bitrate above what it was imported at though -- for this reason, it is best to import an uncompressed sound file (wav or aiff) if you have one, rather than an mp3 file, which has always had some compression applied.

Try changing the Audio Stream setting from the default 16k to 64k and republishing the project_example file to see how the filesize changes.

Compression for event sounds will be applied at the universal value in the Publish Settings screen, or may be overridden individually by right-clicking the sound in the library, choosing Properties, and changing the bitrate or other values.

Intro
Flash: What & How
Example Sites
Create
Draw, Edit Shapes
Gradients
More Drawing Tips
Import
A Sample
Animate
Frames, Keyframes
Motion Tweens
More Motion Tweens
Shape Tweens
Masks
Control
Stop/Replay
Movieclips Intro
Movieclip Reference
Site Structure 1
Slideshow Movieclip
Contact Form
Scroll Resume
Preloader
Site Structure 2
Publish
Display Options
Player Detection
Optimize
AS 2.0 Basics
Intro to Syntax
Playhead Commands
Playhead Cmds 2
Coded Tween
onEnterFrame
Intro to Classes
Declare/Assign
Comments, Trace
Simple Data Types
Arrays & Objects
Code Blocks
Operators
Beyond Buttons
Code Structure
Toggle Controls
Group of Buttons
Drag and Hit
Distort Magnifier
Scroll Text
Bee Game
Dart Shooter
Sound Control
Easing Slider
Easing Slider 2
Components Intro
Timers & Delays
Dynamic Content
Intro
Drawing API
Create Text
Attach Movieclips
Easing Slider 3
Easing Slider 4
Load jpg/swf
Sliding Viewer
Preload swf
XML
Easing Slider 5
Server Comm
LoadVars (w/ PHP)
AS - PHP Lookup
Text File
Database 1:LoadVars
Database 2:Remoting
Read from directory
AS 2.0 Classes
Intro
Math
Key
Date
Color
EventDispatcher
New Samples
Pie Chart
Event-model Emailer
Tween Sequence
Fuse Sequence
SVG in Flash
Bitmap Topo
SWF as Data Holder
Two-level Menu
Yahoo! Flash Maps
Class-based Game
ASTB Samples
Disclaimer
3D Outlines
Bounce Collide
Address Book
Save Drawings
Home  :  Notes Index  :  Resources  :  About/Contact  :  Downloads