0% found this document useful (0 votes)
42 views11 pages

Lecture 01 ADVANCED ANIMATION AS3

This document provides an overview of ActionScript 3 and common uses of scripts in Flash. It discusses the Actions pane where global actions are stored, basic syntactic rules like using semicolons, and controlling timelines and movieclips through methods like gotoAndPlay() and stop(). Examples are given for controlling the main timeline, movieclips, and instances. Common scripting mistakes involving instance names, curly braces, function names, and spelling are also outlined.

Uploaded by

Febb Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views11 pages

Lecture 01 ADVANCED ANIMATION AS3

This document provides an overview of ActionScript 3 and common uses of scripts in Flash. It discusses the Actions pane where global actions are stored, basic syntactic rules like using semicolons, and controlling timelines and movieclips through methods like gotoAndPlay() and stop(). Examples are given for controlling the main timeline, movieclips, and instances. Common scripting mistakes involving instance names, curly braces, function names, and spelling are also outlined.

Uploaded by

Febb Rose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

ADVANCED ANIMATION

AS3
Lecture 01
The Actions Pane (Windows>Actions)

• “Global” actions
appear on the
first frame of a
movie.
2 SYNTACTIC RULES OF ACTIONSCRIPTING

1) Use a semicolon at the end of each line


2) object.method (argument);
like noun.verb (adjective);

Example 1
root.gotoAndPlay(2);
this.gotoAndPlay(2);
gotoAndPlay(2);

Explanation: This script instructs the playhead on the main


timeline (“root” or “this”) to go to and stop on frame 2.
Identifying “root” or “this” by name is optional—the current
timeline is the default, so you could just say gotoAndStop(2);
More Scripts

Example 2
stop() ;
play();
movieclipinstance.play();

Explanation: Some instructions are implied.


 
Example 2
movieclipinstance.gotoAndStop(“musicoff”)

Explanation: This script instructs the playhead inside of a movieclip


instance to go to and stop on a frame that has been labeled
“musicoff.”
2 Most Common Uses of Scripts

• Controlling a timeline
example: stop();

• Controlling a movieclip
example: moviclipinstancename.play(3);
2 Notes:

• Indenting: Flash automatically indents


lines of script so that they are visually
scannable. Blocks are used for visual
scannability as well as practical reasons.

• // This signals commentary that is not


script. //
Main timeline
gotoAndPlay(2) OR
root.gotoAndPlay(2) OR
Controling Time Lines this.gotoAndPlay(2)

A movieclip timeline (“child”)


(the movieclip instance must be named and
must be on stage)
movieclipinstancename.gotoAndPlay(2)
movieclipinstancename.gotoAndStop(2)

OR
instance1.instance2.gotoAndStop(2)
[in the above case, instance1 is inside of
instance2—example, control Godzilla’s breath]

A parent movieclip timeline


parent.gotoAndPlay(2)
parent.gotoAndStop(2)
Methods

To See All Movie Clip Methods:


Flash.Display>Movie Clips>Methods
Popular Methods:
stop
play
gotoAndStop
gotoAndPlay
prevFrame
nextFrame
navigateToURL
Buttons
Mouse Events

To See All Mouse Event Properties


Flash.Events>MouseEvents>Properties>MOUSE_DOWN (and others)

Popular Mouse Event Properties:


CLICK
MOUSE_DOWN
MOUSE_MOVE
MOUSE_OUT
MOUSE_OVER
MOUSE_UP
MOUSE_WHEEL
ROLL_OUT
ROLL_OVER
Common Mistakes That Mess Up Scripts

• 1) Instance Name. First, make sure you have named the instance of your movie clip
that you are applying the script to, and you have targeted that instance name and
NOT the name of the movie clip that’s in the library.

2) Curly Brace. Make sure you have used a curly brace to end your block.

3) Function Names. In each set of instructions, the function name appears twice
(think of them as twins)—make sure they are identical (e.g., mouseDownHandler1
and mouseDownHandler1). BUT, for each separate set of instructions, there must
be separate sets of function names (e.g., mouseDownHandler2 and
mouseDownHandler2. Example: See the scripts for the color picker.

4) SPELLING!  Button instance names and movie clip instance names must be
spelled exactly in the script as they have been named.

5) If all else fails, paste the scripts directly from the tutorial files and only change
the parts in red.

You might also like