Creating a Custom Mouse Curser in Flash

    January 7, 2004

This week I’m going to show you how to make your mouse arrow customized using simple actionscript in Flash.

This is a neat effect you can use if you want the mouse to match the scheme of your site, but try not to go overboard as lots of Flash developers have done in the past.

The first thing we are going to do is open a new file. On the first frame of your movie we are going to add the following actionscript:


This tells our Flash file to hide the mouse cursor when the movie starts.

Now, we need to draw our Mouse curser or import an image that we would like to use. For my file I imported a simple cursor that I created using Fireworks MX. Once we get our cursor ready, highlight the cursor and hit F8. Select the Movie Clip option and hit OK. For good practice make sure to name your instance. I named mine mouse for easy reference.

Now we select we Mouse Movie Clip and add these actions:

onClipEvent (load) {
startDrag(this, true);

This code tells the Flash movie to make our mouse move as you drag your mouse without having to click on it.

Now it’s time to test our mouse! Hit CTRL+Enter and see if everything works. You’ll notice that your mouse may jitter slightly like your computer is going slow. This is actually caused because of the default 12 frames per second. To make the mouse as clean as possible I upped my frames per second to 60, which gave it a nice smooth movement.

Keep in mind to place your mouse in a separate layer. If it’s below any other images or graphics you’ll have yourself the amazing disappearing mouse trick!

You may want to keep the mouse in an entirely separate FLA and use the loadmovie actionscript option to keep it above all of the other layers.

If you have any questions post them in the forums and I’ll be happy to help you out!

Let me know if you have any questions.

Having created the outlines for FlashNewz and FLADownloads, John has become a strong voice in the Flash Community. His reviews and tutorials give great insight and knowledge to readers around the world. He has a keen eye for what’s hot and what’s not in the Flash world. He has also developed and continues to run his own flash portal as a side project to keep his mind on the Flash community

Being a key designer for advertising creative, he’s got style when it comes to grabbing readers attention. With a proven track record, there isn’t much this guy can’t handle.