AS foundation
-----------------------------------
Flash enthusiasts who have done Flash animations know that it is essential to do a flash animation, AS is essential, even if it is just a very simple code, it can also play the role of the entire Flash painting dragon. Here I only briefly introduce the basic common sense of AS.
First we have to understand where the AS is written, when AS will be triggered.
1, frame:
Write an AS above the keyframe, when the pointer on the time axis comes to this keyframe, the AS above this frame is triggered. Common examples have STOP (), etc. written on the frame end of the film. The method of operation is to click on the keyframe and then open the AS panel.
2, button:
Unlike the AS above the frame, the AS above the button is triggered. To write the AS on the button, the operation method is to click the target button and open the AS panel. Even an example can say more.
Suppose there is an animation, let it stop at the same time, then, what you have to do is written in this animation.
STOP ();
Suppose there is a button, the effect is to press the button to stop playback, then the steps are as follows.
Do a button, put it until the main scene, click the button, and open the AS panel. Now if you also write on the button
STOP ();
So, the error will be prompted when the output is output. Correct should write
N (release) {stop ();
Here is the animation of the frame, these code: On (Release) {}, the entire code is translated:
When (release) {stop}
The red code indicates one of the triggered events of the mouse. It is used here that Release release, buttons common events:
Release release
Releaseoutside is released outside the button
Press Press
Rollover mouse enters the induction area of the button
Rollout mouse exits the induction area of the button
It is clear now: AS written on the button is one of this format:
ON (Event) {The code to be executed}
3, MC (movie clip)
If you understand the above content, then write the AS and write on the button on the MC. The operation method is to click the MC and then open the AS panel. Look at an example
OnClipEvent (loading) {stop ();
Similarly, the MC requires an event to trigger the implementation of the AS. Translation This code is
When the clip (load) {stop}
The red code also represents an event. MC's events have the following:
Load load, executed when MC appears. That is, unless this MC is uninstalled, the code in the LOAD event is only executed once.
Unload uninstall, execute when MC is uninstalled.
ENTERFRAME exists for each frame. Each frame exists in the MC is executed. If your scene has 100 frames, a MC has a 100 frame from 41 frames, then the code above this MC executes 60 times.
MouseDown presses the mouse and counts anywhere in the scene. And the button is not the same.
Mousemove mobile mouse, just perform the code as long as the mouse is moved
Mouseup released mouse
Also you want to clear: The code written on the MC must always always this format:
OnClipEvent (event) {code}
See here, if you understand what is different from the frame, buttons, the code on the MC is different, the task is completed. (to be continued)