First step:
Open Flash, create a new movie clip symbol, name "star", draw a star inside, and align its center point with the stage registration point, inserting a keyframe at frame 20th and 40th. Select Frame 20th, hold down the SHIFT key while its center point is aligned with the stage's registration point (you think it's almost done), and then select any frame of frame 1th to 20th to create a motion tween, open the Properties panel and turn it counterclockwise, Select any frame of frame 20th to 40th to create a motion tween, open the Properties panel and turn it clockwise.
Step Two:
When you create a new movie clip symbol, named "Circling Star", locate the "Add Motion Guide layer" in the layers panel to add a boot layer, and hold down the Ait+shift key on the stage to draw a circle with no fill on the floor (size you think fits on OK), Then use the mouse to circle a bit of its edge selected after the deletion (this is to give it a notch), select the drawn circle, put it to the left and top of the center of the stage registration point, select the 40th frame to add a frame, lock the layer, Select the first layer to drag the star in our library and align its center point to the gap in the top of the circle in the guide layer, select frame 40th to insert a keyframe to align its center point to the hole in the bottom of the circle in the guide layer. Back to the stage, put the library in the circle of stars to the stage anywhere, and give it an instance name MC.
Step Three:
Continue inserting a movie clip symbol, named as, and select the first frame to add the following code:
The Var k:number=64;//is used to define the number of stars;
var n:number=16;//is used to define the number of stars in a circle;
var r:number=2; The greater the value of the x and Y coordinates, the slower the values follow when the mouse moves;
for (Var i=1;i<=k;i++) {
Duplicatemovieclip ("_ROOT.MC", "MC" +i,i);
SetProperty ("_ROOT.MC" +i,_rotation,360/n*i);
SetProperty ("_ROOT.MC" +i,_alpha,100/k*i);
}
SetProperty (_root.mc,_visible,0);
Select the second frame where you insert a blank keyframe to add the following code:
for (Var j=1;j<=k;j++) {
SetProperty ("_ROOT.MC" +j,_x,_root["MC" +j]._x+ (_root["MC" + (J-1)]._x-_root["MC" +j]._x)/R);
SetProperty ("_ROOT.MC" +j,_y,_root["MC" +j]._y+ (_root["MC" + (J-1)]._y-_root["MC" +j]._y)/R);
}
Select the third frame where you insert a blank keyframe to add the following code:
gotoAndPlay (2);
After adding code to return to the main scene;
Fourth Step:
Drag and drop the component named as in the library onto the stage, giving it an instance name mc0. Add a layer to the home scene in the first frame plus the drag code:
StartDrag ("_root.mc0", true);
Note Here is MC0 not MC, although you drag the film inside there is no thing, in the following I elaborate;
Even if it's done now, I'll talk about the point here. n Why is it the number of stars in a circle
There is a paragraph in the first for Loop statement,
SetProperty ("_ROOT.MC" +i,_rotation,360/n*i);
Look at the value of its _rotation is 360/n*i
Which is "_ROOT.MC" +i,_rotation=360/16*i
Is
_root.mc1._rotation=360/16*1
_root.mc2._rotation=360/16*2
_root.mc3._rotation=360/16*3
_root.mc4._rotation=360/16*4
_root.mc5._rotation=360/16*5
_root.mc6._rotation=360/16*6
_root.mc7._rotation=360/16*7
_root.mc8._rotation=360/16*8
_root.mc9._rotation=360/16*9
_root.mc10._rotation=360/16*10
... _root.mc64._rotation=360/16*64. ......
That is to say, the 360-degree average is divided into 16, their angle is this value, 360/16=22.5.
The first MC's angle is copied from the original MC angle 22.5 Place, the second MC angle is from the original MC angle 45 from the place to copy out, the third MC angle is from the original MC angle 67.5 of the place to start copying, until the time to 17 overlap, because 360/16 *6=382.5, the maximum angle is 360, when to 382.5 it will be 360 as 0来 calculation, the result is 22.5, when you put the value of n, such as 36 it will have 36 stars around in a circle, 360/36*i is the MC1 angle is 10* 1,MC2 angle is 10*2, MC3 angle is 10*3 when multiply to 37 when its angle is more 10 is 370, the 37th MC Angle will be the original MC angle 370-360 is 10, this is the value of n equals a circle of stars reason.
The code we put in the first frame of the home scene is obviously dragging the MC0, why the video of MC copied will follow the mouse, put in as the second frame set X, y coordinates of the loop code down to analyze:
for (Var j=1;j<=k;j++) {
SetProperty ("_ROOT.MC" +j,_x,_root["MC" +j]._x+ (_root["MC" + (J-1)]._x-_root["MC" +j]._x)/2);
SetProperty ("_ROOT.MC" +j,_y,_root["MC" +j]._y+ (_root["MC" + (J-1)]._y-_root["MC" +j]._y)/2);
}
Look at the x-coordinate of it,
SetProperty ("_ROOT.MC" +j,_x,_root["MC" +j]._x+ (_root["MC" + (J-1)]._x-_root["MC" +j]._x)/2);
SetProperty This sentence is said to set inside the parentheses (target, target property, value of the property);
Our goal now is to mc1,mc2,mc3,mc4,mc5......mc64 the main scene;
What their x-coordinate values are, and why they follow the mouse, let's take a closer look at their values.
_root.mc+i._x_root["MC" +j]._x+ (_root["MC" + (J-1)]._x-_root["MC" +j]._x)/2
Is
mc1._x=mc1._x+ (mc+ (j-1). _x-mc1._x)/2
Suppose MC1 's coordinates are now 300.
namely mc1._x=300+ (mc+ (j-1). _x-300)/2
Now we've got two numbers, and there's a mc+ (j-1). _x, in parentheses, j-1 the first run of the loop, the value of J is 1, which is 1-1, that is 0; that is, mc+0, which is mc0, which is the movie clip that we dragged. MC0 is followed by our mouse movement, the above figure out, we are giving mc0 is the coordinates of our mouse to assume a value. Just set one. Let's assume that the 100 is the value we're going to do arithmetic.
mc1._x=300+ (100-300)/2
Is
mc1._x=300+ minus 200/2
Is
mc1._x=300+ minus 100//note that the more negative is multiplied, the more negative the less, plus and minus the opposite
Is
mc1._x=200;
When the computer is running here, MC1 coordinates is 200, but 200 does not match the effect we see, we run when its coordinates are followed by the mouse, then the program will go down, it will execute the set MC2 coordinates, the MC2 coordinates will be 250, Then the coordinates of the MC3 are 275, and in short, the smaller the spacing of their coordinates, the less you can test.
When the program is out of circulation after 64 cycles, it will Togo to the next frame and execute gotoAndPlay (2);
Back again, and then again 64 times, the code is the same code, not the same is the coordinates have been set up, we look at the MC1 is now the number of coordinates, the last set after 200, then now is
mc1._x=200+ (100-200)/2
Is
150
This coordinate value will be closer to the mouse, until the same as the mouse coordinates, then the same after the same MC will be near, until their coordinates and the mouse is equal, and their coordinates will never be smaller than the mouse coordinates.