Floating Following Mouse

Here I would like to introduce you how to drag movie clip with mouse; how to copy instance of movie clip and set coordinate, alpha and circumrotate for them. Try, place your cursor on the star and drag it, the star will follow the cursor. 
 

 

Series: Sothink SWF Quicker 2.2
Prepared work: download Sothink SWF Quicker -- http://www.sothink.com/product/swfquicker/download.htm

Step one: Create symbol
1. Launch SWF Quicker, set properties for canvas: Width: 400; Height: 250; Color: #3333CC; Frame rate: 100.
2. Hit Ctrl+F8 to create an empty symbol containing nothing, name it empty.
3. Back to Scene one. Hit Ctrl+F8 to create a movie clip symbol, name it move star. Now you enter into movie clip editing mode. Let’s make a star to move in a circle. Please do as follows:

:

 

 

Step two: Add actionscript to copy movie clip and set properties.
1. Back to Scene one, drag two symbols from library to the canvas respectively. Firstly, drag empty. This symbol displayed as a white point, name it star0 in property panel, then drag move star, name it star in property panel.

2. Hit F5 to insert a frame in frame3.

3. Insert a new layer, click frame1 and add following actionscript:
startDrag ("star0", true);
i = 36;
n = 12;
r = 3;
for (counter = 1; i >= counter; counter = counter + 1)
{
duplicateMovieClip("star", "star" + counter, counter + 16384 + 16384);
setProperty("star" + counter, _rotation, 360 - 360 / n * counter);
setProperty("star" + counter, _alpha, 100 - 100 / i * counter);
} // end of for
setProperty("star", _visible, false);
Tips:
i: The number of copies of star;
n: The number if star in a circle;
r: Quotient of speed.
Tips:
duplicateMovieClip("star", "star" + counter, counter + 16384 + 16384);
setProperty("star" + counter, _rotation, 360 - 360 / n * counter);
setProperty("star" + counter, _alpha, 100 - 100 / i * counter); 
Use this method to get 36 copies of star. Set their rotation and transparency. Set the instance of movie clip, named star invisible.

4. Hit F7 to insert a blank keyframe in frame2 and add following actionscript:
for (counter = 1; i >= counter; counter = counter + 1)
{
setProperty("star" + counter, _x, getProperty("star" + counter, _x) + (getProperty("star" + (counter - 1), _x) - (getProperty("star" + counter, _x))) / r);
setProperty("star" + counter, _y, getProperty("star" + counter, _y) + (getProperty("star" + (counter - 1), _y) - (getProperty("star" + counter, _y))) / r);
} // end of for 
Use this method to set “X” and “Y” coordinate parameters for those 36 copies of movie clip.
get property: Returns the value of the specified property for the movie clip.

5. Hit F7 to insert a blank keyframe in frame3 and add following actionscript:
gotoAndPlay(2);

6. Click preview button in tool bar. 

Glad that I could help. Any time, good luck.
 

Back to Top >>

Home

Sothink is a trademark of SourceTec Software Co., LTD.
Flash is a trademark of Adobe.
Sothink Software: Flash to HTML5 Logo Maker

1234