Tutorial source:
http://jinjunshi.blogchina.com
The nine events on the film clip [Learning Objective]: Master the nine events acting on the movie clip in the tutorial seven, eight me introduced everyone to the eight events related to the button and the top ten functions, and pressing the new AS added Three ways, I believe that everyone can do their own personally, it should be mastered, the key is to look at yourself, then do it, then change, so it will increase. In this tutorial, I will tell you the event of the movie clip. Then, continue to introduce the event function and adding methods of the movie clip, the whole teaching idea should understand: Key 桢 - press New - Movie Clip ...
In fact, the film clip is similar to the button. In the process of learning, everyone is going to learn. The movie clip is MovieClip, we generally refer to MC, MC is typically handled with an onClipevent () handler. Its favorite events can have the following: 1, load: The current MC is loaded and ready to display the event. This event can generally do some initialization work, such as the definition of variables, assignment, load an AS file, etc., very useful. 2, unload: The current MC is unloaded to trigger the event before disappearing. 3. ENTERFRAME: The event is triggered each time the contents of the frame is calculated. Basically, you can understand this, triggering this event every time a key on the timeline is particularly useful, such as we do some navigation menu. You will always think of this event when you need to detect some cycles. 4, MouseMove: This event is triggered when the mouse moves. Contrast the rollover of the button. 5, MouseDown: Trigger the event when the left mouse button is pressed. Contrast the press 6, Mouseup: When the left mouse button is lifted, the event is triggered. Comparison button. 7, KeyDown: Trigger the event when the keyboard button is pressed. 8, Keyup: Toned the event when the keyboard button is released. Contrast KeyPress. 9, DATA: The current MC is currently triggered when new data is received. This event is the most closely coupled with loadvariables () and loadmovie () two functions. I saw it, everyone will feel that MC is nothing special, with more loading, unload, Enterframe, Data, but not pressing in the mouse event. The top 9 major events, commonly used is load, Enterframe. :) Let's feel these events of MC in conjunction with examples. Here you need to use a function similar to ON (). OnClipEvent (movieEvent) {
// Here is your statement
} The movieEvent here is one or more of the 9 major events described above. Requirements: Be a flash, view an event of interest in MC. Steps: 1. Create a new Flash document. 2, new MC components Yuan, just draw a round. 3, then build a MC component YUAN_MC, drag the component yuan into, create a motion animation, add a new layer, in the first key plus as: stop (); is this MC is a sports animation, starting. 4, create new layer Yuan_MC, drag the component yuan_mc. 5, newly built four layers are named: show_txt, showef_txt, showload_txt, showcont_txt, put a dynamic text in each layer, corresponding variables are: show_txt, showef_txt, showload_txt, showcont_txt. In order to display the current state. 6. Click on the MC components in Yuan_MC, plus AS. OnClipEvent (LOAD) {_Root.showload_txt = "LOAD event has been completed!";
_Root.showcont_txt = 0;
}
OnClipEvent (mousedown) {
_Root.show_txt = "Now is: mousedown event!";
}
OnClipEvent (Mousemove) {
_Root.show_txt = "Now is: Mousemove Event!";
}
OnClipEvent (keydown) {
_Root.show_txt = "Now is: KeyDown Event!";
}
OnClipEvent (keyup) {
_Root.show_txt = "Now is: Keyup Event!";
Play ();
}
OnClipEvent (Enterframe) {
_root.showcont_txt ;
_Root.showef_txt = "Enterframe event is working:";
} Effect Preview | Source Codes Download above the code you should understand, it is _root. It is the meaning of the main timeline, followed by our special introduction. Dynamic text has not yet speaking, do not understand how to jump, this example is a purpose, let everyone know that these nine events will be. Watching your eyes thinking, what are the events of the MC's function onclipEvent? I know that I can hook my finger.