Newest Articles

MegaCombs
Flash Media Player
XML Driven Pie Chart
Base Defender
Hangman Game
8 Ball Pool


Popular Articles

True Fullscreen Flash Mode
Mp3 Player with XML Playlist
Catapult Game
Infinitely Zooming Image
Create Pong
Base Defender


Random Articles

Moving Clouds and Waving Grass
Growing Tree using Recursion
Flash Media Player
Horizontal Line Transition
8 Ball Pool
Instantiating an Object


Links

Shapes the Game
Reddit
Newgrounds
TWiT
Link to SwfSpot
Swf Spot

Contact me on Google+



rss feed

Custom Mouse Cursor

Custom Mouse Cursor
AddThis Social Bookmark Button
Description: Remove the default mouse cursor and replace it with your own
Author: John Bezanis
Added: March 1st 2007
Version: Flash 8


This simple tutorial demonstrates how to replace the default cursor with a custom one.
First, draw the cursor you'd like to use. Select the graphic using the Selection Tool. Right-Click and select Convert to symbol. Set the name to cursor, the type to Movie Clip, and click Export for ActionScript. Make sure the Identifier is set to cursor. Click OK. Double-click the newly created symbol open and to edit the cursor's position. Move the position so it suits your needs, and double-click the stage outside of the graphic area. This will bring you back to the main level. Now that the cursor graphic is finished, click it and hit delete on the keyboard. It is ok to delete the graphic because it has been added to the library, so we can re-add it using actionscript. Click somewhere on th stage and open up the Actions Frame and insert the following code:
  1. Mouse.hide();
  2. this.attachMovie("cursor", "cursor", this.getNextHighestDepth());
  3. cursor.onMouseMove=function(){
  4.   cursor._x=_xmouse;
  5.   cursor._y=_ymouse;
  6.   cursor.swapDepths(this.getNextHighestDepth());
  7.   updateAfterEvent();
  8. }
This code hides the mouse, replaces it with the newly created graphic, and on each frame moves the new cursor to the current mouse position.

The source file is available below for download.
Download Source File
Comments Currently Disabled