Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

 tutorials:
  Flash 8
  Flash MX 2004
  Flash MX
    Flash 5
  Basic
  Animation
  Special Effects
  Advanced
  Forums
  ActionScript
  Graphics | Motion
  PHP and XML
  Web Technologies
  Swift 3D
   
 

 
 

 

 

 

 

 

 

 

 
Text Masking
: Follow Mouse

After having answered many emails and message board posts on how to create a mask that follows the mouse AND how to drag a mask, I decided to create a tutorial on how to do both. This tutorial is two pages long (one page per each concept).  Before you start off this tutorial, please make sure you understand how to mask objects and how to make objects follow the mouse. The URLs for those topics are mentioned below:

 The example and the tutorial below will help you to create a mask that follows the mouse:

Move the Mouse Over the Animation

Creating A Follow Mask:

Before we start, please download the partial source below. Don't worry, the partial source will not have the key elements to make it work...you'll do that with the information found below. Click here to download the source.

Here's How:

  1. Once you have opened the file "dragfollow_user.fla" that you downloaded from my site, you should see the text and a circle. First, we need to make the draggable object a movie clip. So, the circle will be made into a movie clip. So, click on the circle and press F8. From the window that pops up, choose Movie Clip & enter a name. See image below:

  1. You can name the movie clip whatever you wish to. Now that the circle has been converted into a movieclip, it's time to name the movie. Go to the Instance Panel or (Right Click on Circle > Panels > Instance) and type in the name "drag". See image below:


 

  1. It is not necessary to name the movie clip drag, but it is recommended if you are just learning this. You can name it whatever you want as long as you modify the corresponding code that will follow in a few minutes. For this example, I have named the movie clip "drag". Now, here comes the easy part...the actual masking. Right click on Layer "text" and choose Mask. Once you have done that, your timeline should look like the one below:

  1. The final step is to add the code that makes the movie clip follow the mouse. You may notice that the circle now is within the text itself. That is the direct result of the mask effect. Ok, now, right click on the only keyframe in the Layer movie and choose Actions. From the Actions menu, click on the "+" and choose Actions: startDrag. In the resulting window, type in the name of the movie clip "drag" and click on "Lock mouse to center". Your code should like like the one below:
     

 startDrag ("drag", true);
 

That is all there is to making a mask follow your mouse. Of course, you may download the final source code for the Follow Mask Click Here

I hope the information helped. If you have any questions or comments, please don't hesitate to post them on the kirupa.com Forums. Just post your question and I, or our friendly forum helpers, will help answer it.

The following is a list of related tutorial and help resources that you may find useful:

How to use the Forums
New, Upcoming, and In-Progress Tutorials
How to Help out kirupa.com
Writing Tutorials
 
Cheers!
Kirupa Chinnathambi
kirupaBlog

 

 


kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Buy and sell FLAs at Ultrashock! Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com
Purchase & Download Flash Components flash components
Learn how to advertise on kirupa.com