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

Import Graphics and Sound

So far in this section, we've looked at how to create new content by drawing vector graphics in Flash. You can also import bitmap graphics to be used as a background to your movie, or to be used as pieces in the movie, vector graphics from other published swfs, music files, and video files. For a complete list of the filetypes which can be imported, choose File, Import, Import to Stage and click the Files of Type dropdown. That lists all bitmap, vector and sound formats that may be imported.

Importing Bitmaps

To import a bitmap (jpg, png, gif, bmp, etc), choose File, Import, Import to Stage and browse to find the file. Flash will place a copy of the bitmap on stage and in the library. If you want to use the bitmap graphic as is, it must remain in the library even though there is also a copy (or copies) on stage.

Converting to Vector (if desired)

If you want to turn the bitmap graphic into a vector graphic (in order to animate it, or just to have it look "vector-ish"), you can do so by selecting the bitmap and choosing Modify, Bitmap, Trace Bitmap. These are the options for converting from bitmap to vector -- they control how precise (and large, filewise) the final image will be. This information is from the Flash help file:

To create a vector graphic that looks most like the original bitmap, enter the following values: Color Threshold: 10, Minimum Area: 1 pixel, Curve Fit: Pixels, Corner Threshold: Many Corners

Once the vector graphic has been created, the bitmap may be deleted from the library.

Importing sound files

Sound files are imported by choosing File, Import, Import to Library and browsing for the sound file. You can import wav, mp3 or aif files, among others. wav or aif files are the best option if you have them, since they are uncompressed coming into Flash. You can then select the compression to apply in the Publish Settings of Flash. mp3 files already have some compression applied, which can only be left as is or more applied by Flash (can't "uncompress"). Also, mp3 files may have a pause at the end when looping, which wav/aif files do not.

Importing Illustrator files

You can't import an Illustrator file directly into Flash. But you can open it in Illustrator and cut and paste graphics into Flash. Better yet, you can export your file from Illustrator as a swf (either as one swf, one swf with keyframes = Illustrator layers, or multiple swfs where each = one Illustrator layer). Then choose File, Import, Import to Stage in Flash and browse to find the swf file. Most Illustrator content can be copied precisely this way. Sometimes text does not copy correctly though -- better to create the text with the Text Tool in Flash, or even import a bitmap of the text if it must be precisely formatted.

When a swf that was exported from Illustrator is imported to Flash, the shapes come in as grouped objects. To convert them to native Flash shapes (editable with the Flash drawing tools), select the grouped objects and do Modify, Ungroup or Modify, Break Apart (mac:cmd-B, pc: ctrl-B).

Importing Animated Gifs

It's easy to create a swf from an animated gif. Just choose File, Import, Import to Stage, select the gif, and Flash will import it in keyframes. Resize the stage to be the same size as the gif, publish, and you're done. In the example on the left (sent by a friend), I also added a stop action in the last keyframe and a button to replay, as described on this page.

Side note: you can also export a swf to an animated gif, by choosing that option in the Publish Settings before publishing. My daughter used this often to create AIM buddy icons from Flash animations.

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