Blur object follows the mouse motion

4.3.2009, 0:5
Submited in: Flash | Total Views: 10696

Using this thoroughly explained, detailed flash lesson, you will see how to create an object which follows the mouse cursor. To make this lesson, you have to use a little action script code. Using this lesson, you will also learn how to convert any object into a Movie Clip Symbol, how to create instance name, how to apply blur filter on it and much more!


Step 1

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Select any color as background color. Set your Flash movie's frame rate to 28 and click ok.


Step 2

Call the current layer object. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 3

Select now the Oval Tool (O). In the Colors portion of the Tool panel, block the Stroke color by clicking on the little pencil icon and then on the small square with the red diagonal line. For Fill color choose any color and draw the oval shape like it is shown on the picture below!

Step 4

While the Oval shape is still selected, press F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

Step 5

While the new made Movie Clip (Oval shape) is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip circle. See the picture below!

Step 6

Select now the Selection Tool (V) and click once on the new made movie clip (circle) to select it. After that, go to the Properties Panel (Ctrl+F3) below the stage! Then, select Filters tab from the left side. Click after that on the plus icon and select the Blur filter. Make the adjustments as follows:

Step 7

Create now a new layer above the layer object and name it action. After that, select the first frame of layer action and go to the Action Panel (F9). Then, enter this code inside the actions panel:

circle.onEnterFrame = function() {
 var xMouse = _root._xmouse;
 var yMouse = _root._ymouse;
 if(Math.abs(xMouse - this._x) < 1) {
  this._x = xMouse;
  this._y = yMouse;
 } else {
  this._x -= (this._x-xMouse) / 7;
  this._y -= (this._y-yMouse) / 7;

That's it!

Test your movie and enjoy!

Download example

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials