Use Flash movie clip copy to do "Mouse follow" effects

Source: Internet
Author: User
Tags copy empty
idea:Used in all previous tutorials StartDragTo produce the effect of mouse follow, here I use another way to show you a mouse to follow the effect.
In fact, the mouse to follow plainly is not to ask the location of the object and mouse position? But what if I want it to produce some more dazzling effects to avoid the monotony of the following? First I thought of it. copy of movie clips, because some of the effects I can easily make in the movie clip. With my copy of the movie clips as a follow the mouse, that is, copied the location of the movie clips and the current movie location of the mouse, so that the mouse can not follow it?

Steps:

1, first make a mouse with the appearance of the east, converted into graphic components, (selected objects, F8) attention to the center of the object, so that the following effect to better look at some;

2, press Ctrl+f8, create a movie clip, the first step of the graphic elements dragged in to produce a dynamic effect. What you do with the effect you want, you can also add some color changes to the effect. In the last frame of the dynamic effect plus behavior stop, you can also not add, compare the effect of the difference.

3, create a film clip, notice inside do not place anything, (empty movie clips, as the back control of the second step in the movie clip use);

4. Drag the movie clip created in the second step into the scene, or drag it to the scenes and take the instance name, here for Fang. As shown in figure

5. The empty movie clip created by the third step is also dragged into the stage scene (it exists in the scene for a small dot) and selected.

6, in the case of keeping the blank movie clips selected, F9 opens the as panel and enters the following code:

As shown in figure

Onclipevent (load) {//When animation is turned on, empty movie clips are loaded
I=1; Set the initial number of movie clips to 1
}
Onclipevent (MouseMove) {//when the mouse moves
if (i<30) {//Let movie clips end up with no more than 30 copies
Duplicatemovieclip (_root.fangl, "Fang" +i,i);
Copy the movie clips in the main scene, rename them, and copy them to a new class;
_root["Fang" +i]._x=_root._xmouse;
The horizontal coordinate position of the newly copied movie clip in the main scene equals the horizontal coordinate position of the mouse in the current scene.
_root["Fang" +i]._y=_root._ymouse;
The vertical coordinate position of the newly copied movie clip in the main scene equals the vertical coordinate position of the mouse in the current scene.
SetProperty ("_root.fang" +i,_rotation,random (360));
To copy out of the movie clips randomly generated rotation, since the original movie clip angle is different;
i++;//the number of movie clips from the add, that is, copy once for 2, and then 3 ...
}else{
i=1;//when the movie clip's own number is equal to and more than 30 o'clock, the number of replies to 1, and then cycle replication.
}
}



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.