[Learning goals]: Through simple examples, repeatedly practiced play, gotoandplay, stop use, really understand where to add as.
In tutorial Four we know that there are 3 specific places to load as, that's keyframes, movie clips and buttons, and now we really do it through concrete examples.
When we do animation, if we arrange the "actor" performance in chronological order, we only rely on the positioning of the playhead on the timeline. The specific situation is "stop, broadcast, to a certain frame stop, to a certain frame sowing", or relative said "on a frame, the next frame, the scene, the next scene."
For these timeline positioning, as early to prepare us with ready-made "instructions" is the function bar, corresponding to the following:
1, Stop (): is to suspend the current animation playback.
2, Play (): Suspend animation, continue playing. After the start of the broadcast.
3, gotoAndPlay ([Scene,] frame): To [a scene of] a frames to start sowing.
4, gotoAndStop ([scene],frame): To [a scene of] a frame suspended animation.
5, NextFrame (): Play the next frame, and stop at the next frame.
6, Prevframe (): Play the previous frame, and stop in the previous frame.
7, Nextscene (): Into the next scene.
8, Prevscene (): Into the previous scene.
It's important to note:
① Letter case can not change, AS2 special Ah, case-sensitive.
②[scene],frame here is the condition, that is, the parameters, scene refers to the scene, can be omitted, so used [], omitted to represent the current scene. Frame stands for frames, its value has 2 of cases, one is specific frame value for the number, the second is "label", that value is a string, it must be surrounded by "".
The basics are finished and now you're going to practice using these functions.
Animation requirements: The use of buttons to control the park and square movement.
Steps:
1, the establishment of three components round, square and triangle, this is our conductor of the 3 actors, where the triangle is a rotating film clips.
2, the new layer, the name "round movement", respectively, in the 1, 49 frames inserted into the key frame, the placement of circular components, the establishment of motion animation.
3, the new layer, the name "square movement", respectively, in 50, 100 frames inserted key frame, put square components, set up motion animation.
4. New layer, name "triangle", insert key frame in 1 frame, place triangle element.
5, open the Common Library-button, drag out 5 different buttons, put on five new layers. Named Play,stop,next,prev,gotoplay, respectively.
6, new layer, name "ActionScript", in the 1th frame insert key frame, plus action script "stop ()", the purpose is to start is still, waiting for us to control.
7, in the layer "round movement", the 49th Frame plus action Script "stop ()" ".
8, on the Layer Play button, add Action Script: On (release) {
Play ();
}
9, on the Layer Stop button, add Action script:
On (release) {
Stop ();
}
10, on the Layer Next button, add Action script:
On (release) {
NextFrame ();
}
11, on the Layer Frev button, add Action script:
On (release) {
Prevframe ();
}
12, on the Layer Gotoplay button, add Action script:
On (release) {
gotoAndPlay (50);
}
13, on the layer "triangle", for the movie Clip action script
Onclipevent (MouseDown) {
Stop ();
}
What you are unfamiliar with here is on (release), which is understood to be done when the mouse button is released when the mouse pointer passes over the button ... and onclipevent (MouseDown) is done when the left button is pressed ..., which we want to introduce in detail.
This example is a good experience of 2 points, one is placed in the position, and the second is 8 positioning the playhead "instructions." Go on practicing again and again. To himself understand the stop.