Lecture 01 ADVANCED ANIMATION AS3
Lecture 01 ADVANCED ANIMATION AS3
AS3
Lecture 01
The Actions Pane (Windows>Actions)
• “Global” actions
appear on the
first frame of a
movie.
2 SYNTACTIC RULES OF ACTIONSCRIPTING
Example 1
root.gotoAndPlay(2);
this.gotoAndPlay(2);
gotoAndPlay(2);
Example 2
stop() ;
play();
movieclipinstance.play();
• Controlling a timeline
example: stop();
• Controlling a movieclip
example: moviclipinstancename.play(3);
2 Notes:
OR
instance1.instance2.gotoAndStop(2)
[in the above case, instance1 is inside of
instance2—example, control Godzilla’s breath]
• 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.