When we enjoy flash, we often find that in some animations, the mouse pointer into the screen will become an interesting animation pointer, and the shape will change as you move, click and other movements. In fact, this effect is not difficult to achieve, today we will look at one such example.
Instance effect:
When the animation begins to play, the mouse pointer is an arrow with a constant size, and when moved to the object, it is shown as a hand, and when the left mouse button is pressed on the object, it becomes a "fist" shape; the left button is released and then restored to the hand (Figure 1).
Figure 1 The three styles of the mouse pointer
Production steps:
1, we first make some of the buttons (button) and movie (MovieClip) components needed for this example. Start Flash MX to build a new file, press Ctrl+f8 to create a "object One" button component, because the button is not the focus of this example, so the style is arbitrary. In the same way create a movie (MovieClip) component called Object Two (note: Two different components are made here to describe the different uses of interactive dynamic cursors later).
Create a movie element called "Arrow", make the arrow with changing size, make the process simpler, here is not much to say.
2, press Ctrl+f8 to create a movie symbol named "Animation pointer", press F6 two times, insert two keyframes, so that there are three keyframes on the timeline, add the actions statement for the second and third frames: "Stop ();". Press Ctrl+l to open the component library (library), drag the "arrow" movie that you created in the first step into frame 1th, draw a "hand" flag in frame 2nd, and draw a "fist" flag in frame 3rd. Click the Properties button at the bottom of the window to open the property box, three frames plus frame lable. In this case, we call the 1th frame "Zhengchang", the 2nd frame as "Yidao", and the 3rd frame as "Anxia" (Figure 2).
3, back to the main scene, the library of "Object One", "Object Two", "animation cursor" are dragged into the scene. Click the Properties button at the bottom of the window to open the property box, three objects plus the instance name (Instance name): Object1, Object2, Dhzz, select the object one movie, right-click Select Actions, and enter the following statement (note "//" The following text is a statement description, without input):
On (Press) {
StartDrag ("_root.object1");
}//press the mouse to start dragging on the button
On (release) {
Stopdrag ();
}//to release the mouse and stop dragging on the button
4, using the same method for "object Two" film Plus statements:
Onclipevent (MouseDown) {
StartDrag ("_root.object2");
}//press the mouse to start dragging on the movie
Onclipevent (mouseUp) {
Stopdrag ();
}//to release the mouse and stop dragging on the movie
It is not difficult to see that although all are dragging, but because the object's properties are different, so the statement is also different. In Flash MX, it is very convenient to use the above two kinds of statements to drag any object.
Figure 2 defines the frame name for the keyframe to facilitate management
5. Select Frame 1th on the main scene timeline, right-click to select "Actions", and add the following statement to the frame:
Fscommand ("Trapallkeys", false);
Close player shortcut keys
Fscommand ("ShowMenu", false);
Close the Player right button shortcut menu
function Showzhengchang () {
Dhzz.gotoandstop ("Zhengchang");
}//defines the style of the mouse pointer when an animation is playing normally
function Showyidao () {
Dhzz.gotoandstop ("Yidao");
}//the style of the mouse pointer when moving to an object
function Showanxia () {
Dhzz.gotoandstop ("Anxia");
}//the style of the mouse pointer when the left mouse button is pressed on an object
Object1.onrollout = Showzhengchang;
Normal mouse pointer style that is not displayed on an object
Object1.onrollover = Showyidao;
Displays the defined pointer style when the mouse moves to object one
object1.onpress = Showanxia;
Displays the defined pointer style when you press the left mouse button on "Object One"
Object1.onrelease = Showyidao;
Display the defined pointer style when releasing the left mouse button on "Object One"
Object2.onrollover = Showyidao;
Object2.onrollout = Showzhengchang;
object2.onpress = Showanxia;
Object2.onrelease = Showyi
Dao
"Object Two" and "object One" statement similar, we should pay attention to the format of the statement.
So far, it's done! Press Ctrl+enter to appreciate the fruits of your labor. How, feel good! If the "hand-shaped" and "fist" style is also all made into animation, the effect will be more "cool" Oh!