Professional Documents
Culture Documents
EDUCATION
Adobe Flash CS 3
1
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Reviewed by:Dr. Manjula Sandirigama (B.Sc. Eng. (Peradeniya), M.Sc. (Ehime), PhD (Ehime), Department of Computer Engineering,
Faculty of Engineering, University of Peradeniya.
Disclaimer: Material and images freely available on the web have been incorporated without prior written permission from the original source
/ author as those are solely used for educational purposes.
The authors have taken all possible effort to minimize the errors. However this document may not be error-free. The authors welcome all
suggestions to improve this material. The authors and institutions to which authors belong accept no responsibility with regard to the problems
including damages and losses arising from using or not using this manual.
2
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Adobe Flash (previously called Shockwave Flash and Macromedia Flash) is a set of
multimedia software created by Macromedia and currently developed and distributed by Adobe
Systems. Since its introduction in 1996, Flash has become a popular method for adding
animation and interactivity to web pages; Flash is commonly used to create animation,
advertisements, and various web page components, to integrate video into web pages, and
more recently, to develop rich Internet applications.
Flash can manipulate vector and raster graphics and supports bi-directional streaming of audio
and video. It contains a scripting language called ActionScript. Several software products,
systems, and devices are able to create or display Flash content, including Adobe Flash Player,
which is available for most common web browsers, some mobile phones and other electronic
devices (using Flash Lite).
Files in the SWF format, traditionally called "ShockWave Flash" movies, "Flash movies" or
"Flash games", usually have a .swf file extension and may be an object of a web page, strictly
"played" in a standalone Flash Player, or incorporated into a Projector, a self-executing Flash
movie (with the .exe extension in Microsoft Windows). Flash Video (FLV) files have a .flv file
extension and are either used from within .swf files or played through a flv aware player, such
as VLC, or QuickTime and Windows Media Player with external codecs added.
It is written using C++ Programming Language. The latest version is Flash CS4.
Action Script
Action Script is the programming language which is used to write the scripts in Flash. This
comes with several versions such as ActionScript 3.0 or ActionScript 2.0 so on.
To start Flash, if available, the shortcut can be used or follow the following steps.
Start Ö All Programs Ö Adobe Web Premium CS3 Ö Adobe Flash CS3 Professional
1
3
2
3
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
1. Open a recent Item - This shows the files, which were created recently or it
allows opening an already created flash file.
2. Create New- This shows several options to create different kind of flash
files. Normally we use Flash File (Action Script 3.0).
3. Create from Template - This shows the available template comes with flash.
Set up a document
After creating a new flash file, we can set the document properties
Modify ÖDocument
4
5
6
1. Title - What do you want to display as the title of the Flash Movie
4
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Flash Interface
Frames
Time Line
Panels
Tool Box
Stage
Properties
Tool Box
Most of the major tools are located in the Tool bar for easy access. The tools are in Flash are
very similar to the tools in Photoshop.
Panels
Panels contain functions that help to monitor and modify images. These are similar to palettes
in the Photoshop.
Stage
This is the Working area of the Flash file.
Properties
This is also a panel, which shows the available properties of the selected tool.
Time Line
2 3
4
5
1
6 7 8 9 10 11 12
5
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
1. Layers - The layers are displayed as a stack. The first layer is the Top layer of the
document.
2. Show/hide all layers - This icon acts as a toggle button. Open eye implies all the layers
are visible. The column displays the show/hide options for each layer. To hide a
particular layer, you have to click the appropriate dot in that layer.
3. Lock/unlock Layers - This is used the lock or unlock layers. When a layer is locked,
the changes can’t be done to any content in that layer.
4. Play Head - The playhead indicates the current frame displayed on the Stage. As a
Flash document plays, the playhead moves from left to right through the Timeline.
7. Add Motion Guide - This is used to add the motion guide to the document. The motion
guide is added as a separate layer.
8. Add a Layer folder - This is used to add a layer folder. The Layers can be added inside
this folder. This will help to organize the layers.
12. Elapsed Time Indicator - It shows the time difference from the starting.
6
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Tool Box
Fill Color: Display the color that fill when paint bucket tool is used.
7
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Crating a Simple Flash Document
Before creating a simple animation, a new file has to be created. After creating a new file set,
the document properties are as follows.
There are several tools can be used to draw different shapes and lines in Flash.
Line
Pencil
Brush
Line tool is used to draw straight lines in any direction. With shift key, you can draw the lines
in horizontally or vertically.
Pencil Tool is used to draw freeform outlines.
Rectangle Tool has the hidden tools such as oval, Rectangle primitive (to draw rounded
rectangles), oval primitive (to draw a fraction of an oval) and PolyStar tool (to draw polygons
or stars).
The text can be inserted to the Flash document using Text tool. When the text tool is selected,
the property panel will display the options for customizing the text.
8
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Transforming an Object
The free transform tool is used to rotate and change the size of an object in the stage. The
Gradient Transform tool is used to rotate the gradient filling of an object.
Selecting Objects
The select tools can be used to select the whole object or a part of an object. There are three
main selection tools in Flash.
Selection Tool
The selection tool can be used to create customized shapes from the available shapes.
9
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Subselection Tool
This tool is used to view and select anchor points that make up vector objects drawn in the
flash document.
Lasso Tool
The normal delete button or an Eraser tool can be used to delete object s on the stage.
When the eraser tool is selected its option is available in the tool box as follows.
Eraser Mode
Faucet
Brush Size
Erase by clicking
Double -click the eraser tool to delete all the objects on the stage
Or
Select the Eraser tool, and then click the Faucet modifier
Click the stroke segment or filled area to delete that area only.
Erase by dragging
10
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Symbols in Flash
A symbol is a graphic, button or a movie clip, that can be reused once it is created. It can be an
object or a group of several objects. Once it is converted to a symbol, it is saved as a library
item in that Flash file. There three types of symbols available in Flash.
Graphic - This type is used for static objects. Graphic symbols operate synchronously with the
movie’s time line.
Button - This is used to create Interactive Buttons in a movie that responds to the mouse click.
A button has several status such as up, over, down and hit. Separate graphic formats can assign
to that states.
Movie clip - This is used when creating a symbol for movie clips. This symbol is independent
from the main movie’s time line. When creating motion guides you have to convert objects in
the stage as a movie clip symbol.
An instance is a copy of a symbol located in the stage. Its size and orientation can be changed
after inserting to the stage.
To convert to a symbol
Draw the objects in the stage
• Select the objects
• Choose Modify menu Ö Convert to Symbol
• Select either Graphic, Button or Movie Clip and give a name for the Symbol
• After Pressing OK it will come to the Library panel
11
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Example: Creating the following Flash Document using Shapes and Text tools.
• Create a new Flash document selecting Flash File (Action Script 3.0)
• Open the Document Property Window set the options as follows
Title - Example1, Description - Learning Flash , width – 550, height - 300
Background col. - light yellow, frame rate - 12 fps, Ruler Unit - select inches
• Change the name of the layer1 by clicking on layer1 as “Background”
• Select the rectangle tool; change the properties in the property panel as follows
Stroke Col (SC) -dark Ash Stroke Size (SS) - 4 Fill Col (FC) - black
• Click and drag to draw the rectangle to draw the one side of the road.
• Copy and paste the rectangle, and move it to the correct place as in the above figure.
• Insert a new layer and name it as the Bus
• Use the rectangle tool and change the properties as follows to draw the bus
SC - Light Ash, FC - Red , SS - 2 ,
Upper rounded edges - 2 (unlock before changing)
• Draw the rectangle to draw the bus structure
• Select the rectangle tool to draw the windows and set the properties as follows.
SC – black, FC – white, SS – 1, Upper & lower rounded edges - 2
• Draw one rectangle out side from the bus. Copy it 4 times and arrange it as those four
windows fit to inside the bus structure. Then move that to the correct place.
• Change only the lower rounded edge value to 0 and draw the door.
• Insert a new layer rename it as “wheels”
• Select the oval tool to draw the wheels and set the properties as follows.
SC - Dark Ash FC - Light Ash SS – 9
• Click and drag on the stage draw a wheel.
12
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
• Get a copy of it, move both ovals to the correct place.
• Insert a new layer; name it as “stop”.
• Using the rectangle tool and oval tool to draw the bus stop.
• Use the type text tool to type the word “STOP”. Change the font size, until it fits to the
oval.
• Save the file as Flash CS3 document.
Animation in Flash
The objects in the stage can be animated using the option in Flash. The objects can be moved
across the stage and can be changed their shape, size, color or opacity and can rotate over the
time factor. When creating animation, some of the frames are defined as Key Frames. Key
Frame is a frame where changes in the animation are defined. Simply, we can create frame by
frame animation; i.e. create different frames and animate or tweened animation; i.e. create first
and last frames and met Flash to build the rest of the frames.
Frame-by-Frame Animation
If the contents in the stage are changing frame by frame; we have to use the Frame-by-Frame
Animation option. This increases the file size because Flash stores the values for each data in
each frame.
In Frame-by-Frame Animation all the frames should be defined as Key frames.
Ex :
To create the animation for these 4 frames, all the frames should be defined as key frames.
Since the number of frames is limited and not a large number frame by frame animation is
good with a low frame rate.
13
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
To create a Frame-by-Frame Animation
Tweening
Only first and last frames of layer are defined as the key frames. The changes are done only in
those layers. Flash builds the intermediate steps. There are two types of tweened animations in
Flash.
Motion Tweening
Shape Tweennig
14
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
• Choose Insert menu Ö Timeline ÖCreate Shape Tween. (or click the right mouse
button on that frame to get the dropdown menu and select Create Shape Tween)
• Place Playhead to the starting frame and Choose control Ö Play to test the animation.
(or press Enter key)
In the example an oval is moving from one place to another using motion tween and a star with
8 sides is converted to a star with 4 sides using shape tween.
Example contd: Create the motion Tween for the bus and stop the bus in the bus stop.
In the above example you have got to know, in the motion tweens Flash uses the shortest path
to move from the starting to the destination. In some situation we have to use a path to move
the object.
15
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Step 4: Snapping the symbol to each end of the motion guide line
• Choose Insert menu Ö Timeline ÖBlank Keyframe
• With View Ö Snapping ÖSnap to object is on, use the arrow tool to click in
the center of the symbol. Holding the mouse button down, drag the graphic to
snap it to the left end of the motion guide line. (A black circle appears under the
cursor as the symbol is being moved, to indicate that it will be snapped to the
motion guide.)
16
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
• Choose Insert menu Ö Timeline ÖCreate Motion Tween (or use the dropdown
menu)
• In the Motion Property Panel check Orient to Path option to make the object
turn as the line turns.
An object with animation can be converted into a Movie Clip Symbol. Then it can be reused
with that animation also.
17
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Example contd: Create the wheels as shown in the following picture. Create the wheel’s
motion.
Example contd: Insert a new layer and create a Stick man with hand and leg animations.
When you put the hand and leg animation separately, you can see the different pauses as in the
above figure.
Example contd: Using the Motion Guide, move the stick man to get the bus at the bus stop.
18
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
percentage of change. The first keyframe is represented as 0%, and the last keyframe is
represented as 100%. To add a control point, press Control-click and to increase the speed of
the object, drag the control point up, to slow down the speed of the object, drag it downwards.
The picture files, sounds or other movie clips can be imported to the stage of the Flash file or
as a library item. The library in a Flash document stores media assets that you create in the
Flash authoring environment or import to use in the document.
Buttons are four-frame interactive movie clips which can be used in the flash movies or web
sites. The first three frames display the button’s three possible states; the fourth frame defines
the active area of the button. The Timeline doesn’t actually play; it reacts to pointer movement
and actions by jumping to the appropriate frame.
To make a button interactive, an instance of the button symbol has to place on the Stage and
assigns actions to the instance. The actions are assigned to the instance of the button in the
document, not to frames in the button’s Timeline.
Each frame in the Timeline of a button symbol has a specific function:
Up State - The button appearance when the mouse pointer is not over the button.
Over state - The button appearance when the pointer is over the button.
Down state - The button appearance when it is clicked.
Hit state - This shows the clickable area of the button.
19
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
How to Create a Button
ActionScript
ActionScript is the programming language which is used in the flash movies to add
interactivity to the Flash applications. ActionScript can be used for simple programming and
advance programming also. Flash is "event-driven," meaning that events trigger scripts to
execute. Even after you write a script, you must select an event to trigger that script.
ActionScript started as a scripting language for Macromedia's Flash authoring tool, now
developed by Adobe Systems as Adobe Flash. The first three versions of the Flash authoring
tool provided limited interactivity features. Early Flash developers could attach a simple
command, called an "action", to a button or a frame. The set of actions was basic navigation
controls, with some commands such as "play", "stop", "getURL", and "gotoAndPlay". In this
book, we will discuss how to control a Flash Movie with simple codes of ActionScript.
ActionScript Basics
Actionscripts codes are written on ActionScript Window.
20
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Syntax:
ActionScript has its own rules of grammar and punctuation that determine which characters
and words are used to create meaning and in which order they can be written. ActionScript has
syntax rules that you must follow to create scripts that can compile and run correctly. The
comment lines can be added with ‘//’ and it will not execute as programming codes.
Components
There are predefined movie clips specifically designed for ActionScript are available in
Flash as Component.
How to get the Component window.
21
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Each component has several properties and methods. To refer a particular method of a
component, the following syntax has to be used.
Instance_Name.PropertyName
Ex: My_Label.Text
If you want to assign some values to that property, you have to use the assignment operator.
Ex: MyLabel.Text = “This is the text appear in the label Component”
All your scripts are written in the Actions panel, but there are three places you can attach
scripts: keyframes, button instances, and Movie Clip instances.
Keyframe scripts are probably the easiest to understand. You simply select a keyframe and
open the Actions panel to create a script. When the frame is reached, a frame script is
triggered.
22
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Stage in the editing Mode Starting the Movie After Some time period
When adding the actions to a button, the event has to be chosen first. Then the actions will
occur when the event is triggered.
Some Actions are as follows;
Button can be created as your own or can be inserted using Component window or external
Library Window. There are so many button categories in the external library window.
Selected Button
Button Categories
Buttons
The ActionScript in Adobe Flash CS 3 does not allow adding action to movie clip or button, so
all the action will be on the timeline frame as one code window.
If you want to write the coding to a button, you have to use the Event Listener. The Event
listener means it will listen to the mouse action such as mouse release, mouse roll-over, mouse
23
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
click or mouse roll-out etc. When this event happens, it executes the function that includes
what you need to object to do when clicked.
Syntax
Button_Instance_Name.addEventListener (MouseEvent.MOUSE_EVENT,
Function_Name);
Ex: If we add a button to the stage and name it as btn_Play. Here is the coding for Mouse Click
event.
Btn_Play.addEventListner(MouseEvent.CLICK,BtnPlay_Click);
function BtnPlay_Click (event:MouseEvent): void
{
Play( );
}
24
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
btn_play.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownPlay); function
mouseDownPlay(event:MouseEvent):void
{
play( );//this command is to play the flash motion
}
Ex:
drill_btn.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function
mouseDownHandler(event:MouseEvent):void
{
gotoAndStop(20); // This will jump to Frame 20 an wait
}
25
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Btn_URL.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); function
mouseDownHandler(event:MouseEvent):void
{
navigateToURL(new URLRequest(“www.rivira.lk”); // This will open the web site
}
To add an action to a movie clip, you will need to follow the above steps, but you will need to
tell Flash that to deal with this movie clip instance, as if it were a button and shows a hand
curser when the mouse goes over it. This will be done by adding action script to the button
Flash files can be saved as a flash document, but the Flash software is needed to open the files
with .fla extension.
If a flash file is needed to put in a website, it should be saved as a shockwave flash object.
(.swf)
• File menu Ö Publish Setting to select the option. You can SWF and HTML options are
checked by default, but if you want to publish as any other format, you can select.
• Choose File menu Ö Publish to create swf file and the HTML file.
• Then you can see there are two other files have created with the same name but in
different extension. SWF file can be open without flash also. HTML file will open
through a browser.
Ex:
<body>
<h2>My Flash File</h2>
<EMBED src="actioSc1.swf" quality=high bgcolor=#008080 WIDTH="320" HEIGHT="240"
ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED> </body>
26
Copyright © 2010 by Information Technology Center, University of Peradeniya
CeIT
EDUCATION
Exercises
1) Create a simple MCQ type quiz using Flash and ActionScripts. The following figures
show some stages of the quiz. The flash file should contain two frames, containing
questions and 3 possible answers. When someone clicks on the correct question, the
feedback should be given and the next button should be visible. Apply the same
formatting and logic for the second question in the second frame, but there will be a
back button to come back to the first screen.
2) Create your own web site using flash, with four pages in it. Use four frames as the four
pages in the web site.
27
Copyright © 2010 by Information Technology Center, University of Peradeniya