Custom cursors are always a nice effect for a site. They add a nice look, and can help the mood you wish to create. But, how hard is it to include one in your own site? Actually, it's surprisingly easy, as you will soon find out.
Now, first thing's first. Design you cursor anywhere on the stage (Flash screen). Once you have finished and are happy with what you have, select the whole thing, and press F8. This makes it into a Movie Clip. The name of the clip doesn't matter, but I named mine Cursor, so it's easy to find in the Library (Ctrl+L). Now, making sure that you are in the main movie, not your Movie Clip, right click on the Instance (copy of the movie that is on your stage) of the Movie Clip, and then go down to panels and click on Instance. This is where you can give it a name that Flash will refer to in the ActionScript portion of this movie.
Leave the Behavior as Movie Clip, but in the blank text field below (Name), type in cursor. You CAN type whatever you want, but if you always use the name cursor for your cursors, you will never run into problems with forgeting what you've named them.
Double click on your new Movie Clip. See that little cross right in the middle? Didn't draw that, did you? That is the mouse's "Hot Spot", and that is where it will stick to the original mouse of the person viewing your clip. It is also where buttons feel your mouse, so if you have a pointy cursor, which I recommend you do (people are used to pointy cursors), move the image you have to that it's tip is right on the cross.
Now, go back to your main movie (Ctrl+E). There should now be a blue box around our cursor. Right click on the first frame in your timeline, and click on actions. In the ActionScript window, click on the plus sign, go to Actions, and then click Start Drag. In the text field that appears, type in the name of the Instance of your Movie Clip (we named ours cursor, remember?). Don't click the box marked "Expression", and don't click "Constrain to Rectangle", but DO click on "Lock Mouse to Center", or your cursor will not move. This action stick your movie onto the mouse.
We could just leave it at that, but then we would be left with an unsightly white default mouse over top of our lovely graphic, and we don't want that.
To get rid of the original mouse (something you may consider doing when you get into complexe animations and things where you don't want the mouse in the way, even without and alternative cursor), all we need to do is add another, much simpler action into Frame 1.
In the ActionScript box, click on the plus sign again, but this time, instead of going to Actions, go to Objects, then to Mouse, and click on Hide. There. Easy. Now just test your movie (Ctrl+Enter), and admire your work!
NOT WORKING? Download my file and check my code.
|» Level Basic|
Rating: 8 Votes: 45
|Howells Daly Enterprises, H.D.E Web Creations division.|
|Download the files used in this tutorial.|
|Download (1 kb)|
|More help? Search our boards for quick answers!|