Macromedia Flash MX: A Brief Tutorial For "Programming Usable Interfaces"
Macromedia Flash MX: A Brief Tutorial For "Programming Usable Interfaces"
Versions
Macromedia Flash MX Not Flash MX 2004 (the newer
version)
No site license PC version: Wean clusters, Cyert Hall Mac version: Hunt Library, Cyert Hall
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
A Beginners Book
Foundation Macromedia Flash MX Kris Besley Comes highly recommended on Amazon ~$10 paperback on Amazon and
Half.com
Drawing
What is Flash?
Timeline Stage Vector Graphics
Palettes
ActionScript
The Stage
The Stage
Modify Document...
Vector Graphics
All shapes in Flash are made out of points, lines, and curves. Even this one:
Options
For rectangles, the radius of the corner
Click once to make a straight line in the path. Click and drag to make a curve. Click on a previously made point to close the shape.
Pay close attention to the changes in the cursor with this tool.
Brush Strokes
Brush
Like brushes in other applications, has a radius and shape. The options also allow for filling behind, selection, inside...
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Like erasers in other applications, has a radius and shape. The options also allow for erasing fills, lines, and other things.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
The Timeline
A view of all of the frames and layers in
your movie
Frames
Frames
Frames
The hollow white The black dot The grey frames 2-12 have rectangle means means that frame the same content as the that it is the end of 1 is a keyframe frame 1, the keyframe the span of frames. A keyframes defines the content of all frames following it, up until the next keyframe.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Frames
Frame 1, a keyframe, has a black oval on the stage. All of the grey frames following it have the same black oval as frame 1. The last frame that with the black oval is frame 12, represented by the white rectangle. This movie will show this black oval for 12 frames (1 second) and then loop. Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Frames
If we want to change what the 13th frame displays, we insert a keyframe Inserting actually just changes the selected frame to a keyframe.
Frames
Now, the first 12 frames have a black oval. The 13th frame has a red oval of the same size.
Layers
Just like Illustrator and other
applications, Flash supports layers of content.
The layers are part of the timeline. Layers can be locked, hidden, and organized
in folders.
Layers
Here Ive renamed Layer 1 to Nose and added a layer called Face
Layers
Then I added an Eyes layer, and drew the eyes and mouth.
Symbols
Symbols are tricky. Symbols can also be thought of as a class. A single Button class many Button
instances
Types of Symbols
On their own time, not necessarily in sync with the main timeline.
Types of Symbols
Buttons Special kind of Movie Clip symbol that
responds to clicks, rollovers and other actions.
Making a Symbol
You can make a new, blank symbol by going to InsertInsert Symbol... Here, we have selected the eye (by locking the nose and face layers and dragging a box around the eye), so the menu says Convert to Symbol instead.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
The Library
Now, the eye appears in the Library as a new symbol. The library contains all of this Flash documents symbols.
An Instance of a Symbol
Now, the left eye is an instance of the AnimatedEye symbol After erasing the right eye, we can drag a new instance of the AnimatedEye symbol from the library for the right eye. Now we have two instances of the animated eye symbol, each with their own positions, but sharing the symbols timeline, layers, etc.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Naming Instances
Its important to name an instance if you want to refer to it in code. We name the left eye leftEye by selecting the left eye and changing the instance name in the property window.
We do the same for the right eye.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Editing a Symbol
To edit a symbol, doubleclick on the symbol in the library (either the name or image).
Notice that the timeline, layers, and stage are now specific to the AnimatedEye symbol.
Our view is now inside the main scene. You can return to it by clicking here.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Editing a Symbol
Lets make the eyes blink every 1/12th of a second. If we right-click on the 12th frame in the eyes timeline and select insert frame, it inserts frames in between. Then we make a keyframe, and change the eye so that it is blinking.
ActionScript
ActionScript
ActionScript code is associated with
frames, Movie Clips, and Buttons.
atan2() takes the x and y deltas and returns the degrees in radians.
This sets the rotation of the left eye to the value of degrees.
Then, well avoid rotating the eye if its in the middle of blinking.
Finally, well copy the code from the left eye to the right eye.
Buttons
Buttons are a
special type of Symbol, which have frames for each of their states.
Lets make
Buttons
A Button has four frames, each defining its appearance and behavior in different states. Up is when the button is not pressed, or released.
Over is when the button is hovered over. Down is when the button is pressed. Hit defines the clickable area of the button.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Up
The noses up frame will be just as it is.
Over
To make the noses over frame, insert a keyframe. Ive filled the nose with brown. If we dont make a keyframe, this changes the up frame to brown as well.
Down
To make the noses down frame, insert a keyframe.
Hit
By default, the clickable area is defined by the oval on the screen.
Button Events
To make an event for the button, select the NoseButton instance on the stage, and open the Actions window. Use on(event) to respond to press, release, rollOver, etc.
Button Events
When pressed, the eyes will goto frame 12 (the blinking frame) and stop playing.
When the nose button is released, the eyes will go to frame 1 and start playing.
Intro The Stage Vector Graphics Timelines Layers Symbols ActionScript
Button Events
Button Events
Well remove the keyframe with the red nose, so the nose button is clickable for the whole movie.
Button Events