Aborigines series as Getting Started Tutorial--basic article _flash as

Source: Internet
Author: User
I write these tutorials, the purpose is to hope that beginners flash enthusiasts can more hands-on, less questions. I have the following tutorials that look like a reader of the basic operating knowledge of Flash (MX).

As Foundation
-----------------------------------
Flash animation Flash enthusiasts know that to do a flash animation, as is essential, even if just a few simple code can play the role of the entire flash finishing. Here I simply introduce the basic common sense of as.
First we need to know where the as is to be written and when as will be triggered.
1, Frame:
As on the key frame, when the pointer on the timeline goes to the keyframe, the as on which the frame is written is triggered. A common example is a stop () and so on in the frame at the end of the movie. The action method is to click the Keyframe, and then open the as panel.
2, Button:
Unlike the as above the frame, the as on the button has a trigger condition. To write as on a button, the action is to click the Target button, and then open the as panel. For example, you can make it more clear.
Suppose there is an animation that you want to stop at the end of the play, then all you have to do is write as in the last frame of the animation.

Stop ();
Suppose you have a button that stops playing after you press the button, and the steps are as follows.
Make a button, put it in the main scene, click the button, and then open the as panel. Now if you're writing on the button,

[Copy to Clipboard] [ - ] CODE:
Stop ();
Then, the output will be prompted with an error. That's the right thing to write.
On ([Color=red]release[/color]) {
Stop ();
}
This is more than the animation of the frame: on (release) {}, the entire code translates as follows:

[Copy to Clipboard] [ - ] CODE:
When (loosen) {
Stop it
}
The red code represents one of the trigger event events for the mouse, which is used for release releases and buttons for common events:
Release released
Releaseoutside out of the button.
Press down
Rollover mouse into the sensor area of the button
RollOut the sensor area where the mouse leaves the button

Now it's clear: the As that is written on the button must be in this format:
On (event) {Code to execute}

3, MC (movie clips)
If you read the above, the same as and written on the MC are the same as the one on the button. The way to do this is to click the MC and then open the as panel. See an example

Onclipevent ([Color=red]load[/color]) {
Stop ();
}
Similarly, the MC needs an event to trigger the execution of AS. The code for translation is

When clip (load) {
Stop it
}
The red Code also represents an event. The events of MC have the following:
Load load, execute when MC appears. This means that the code in the Load event executes only once, unless the MC is uninstalled.
Unload Uninstall, when the MC uninstall the execution.
Enterframe every frame that exists. Code is executed once in each frame where the MC exists. If your scene has 100 frames, there is a MC from 41 frames to appear to 100 frames to disappear, then the code above the MC executes 60 times.
MouseDown press the mouse, it is counted anywhere in the scene. And the button is not the same place.
MouseMove move the mouse, just move the mouse to execute the code
MouseUp Release Mouse

Again, you have to be clear: the code written on the MC must always be in this format:
Onclipevent (event) {code}

See here, if you understand the writing in the Frame, button, MC Code on what is different, the task is completed. adjourned

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.