This is a quick tutorial to show you how to banish the standard mouse cursor and replace it with you own creation in two VERY simple steps! Your end result will be somthing like this:
STEP 1
Open a new actionscript 2 file, set the framerate to 30 and rename layer 1 to ‘cursor’. Create a new layer called actions. On the cursor layer, draw your custom cursor. This can be ANYTHING you like. As you can see I have gone with a target, useful for flah shooting games etc.
Once you have drawn your cursor, select all of it and press f8 to convert it to a movieClip. Name it MC_cursor, and set the registration point to where you want the ‘tip’ of the cursor to be. For example, I have set it central as the click area is the center of my target.
Once you have done this, give your movieClip an instance name of MC_cursor.
STEP 2
The next and final step is to add the actionscript to replace the cursor. Select frame 1 on the actions layer, press f9 to access the actions panel and add the following lines of actionscript:
Mouse.hide()
startDrag(MC_cursor,true)
The first line simply hides your standard mouse cursor. The second line will make the movie clip MC_cursor get continually dragged by the hidden mouse cursor. Hit CTRL + enter and see it in action. Simple!
This is a great way to customise you flash applications, websites and games in two simple steps. So experiment and see what you can come up with!
Enjoy
The Dude
Did this tutorial help you? If so, click the bookmark button, stumble me, add me to your twitter and tell your friends! Alternatively, sign up and leave a comment!
Not what you were looking for? Then leave a comment or email me and we’ll get you the tutorials you need.
Did this post help you? If so help us continue to grow and Digg this page or Share on Twitter!
If you haven't already, sign up to our RSS feed or register to recieve updates direct to your email!








Hey more pics please, you must balance the text and the pictures
Your voice has been heard, and comments noted! I will provide more pics for future tutorials
Question: If I want to have a custom cursor in one scene of my movie, can I…de-customize it for the next scene(s)?
And thanks, btw.
Question: I have put Actionscript together for using a new curser. How can I make the curser change to a new picture when mouse is clicked.
Great, i have been looking for something similar…
I need help i am making a shooting game, this new cursor is great but i have a target that i can no longer click, can help me?
not sure if this is the problem but just in case this is the actionscript of the target(moves randomly once hit):
on(press){_x=random(500);_y=random(350)}
So now my son is peeking over my shoulder saying daddy make me one..so cool!
@gafaaa:
that’s weird, it should be (AS2)
_root.(target name, example: target).onPress = function()
{
_x = Math.random() * 1000 - 500 (the target will move up to 500 pixels to the right or to the left)
_y = Math.random() * 700 - 350 (same as above)
}
@learner:
(AS2)
select your mouse. convert it to a symbol (f8) and put in class and all others : mouse
select the symbol, and put cursor in the instance name part
select the symbol, double klick, then your editing the symbol (your “inside”it)
then make a new layer, or two, depending on how many pictures you want to make. if you have 5 pictures, then make 4 layers, so you have 5 layers in total
make in every layer a picture, and convert all to symbol. put in instance name pic 1, pic 2, pic 3 pic 4 and pic 5
make a new actionscript file (crtl-n, select actionscript file). put in the class the following code
class mouse extends MovieClip
{
var type
function onLoad()
{
type = 1
_root.cursor.pic 1._visible = true
_root.cursor.pic 2._visible = false
_root.cursor.pic 3._visible = false
_root.cursor.pic 4._visible = false
_root.cursor.pic 5._visible = false
}
function onEnterFrame()
{
if(type == 1)
{
_root.cursor.pic 1._visible = true
_root.cursor.pic 2._visible = false
_root.cursor.pic 3._visible = false
_root.cursor.pic 4._visible = false
_root.cursor.pic 5._visible = false
}
if(type == 2)
{
_root.cursor.pic 1._visible = false
_root.cursor.pic 2._visible = true
_root.cursor.pic 3._visible = false
_root.cursor.pic 4._visible = false
_root.cursor.pic 5._visible = false
}
if(type == 3)
{
_root.cursor.pic 1._visible = false
_root.cursor.pic 2._visible = false
_root.cursor.pic 3._visible = true
_root.cursor.pic 4._visible = false
_root.cursor.pic 5._visible = false
}
if(type == 4)
{
_root.cursor.pic 1._visible = false
_root.cursor.pic 2._visible = false
_root.cursor.pic 3._visible = false
_root.cursor.pic 4._visible = true
_root.cursor.pic 5._visible = false
}
if(type == 5)
{
_root.cursor.pic 1._visible = false
_root.cursor.pic 2._visible = false
_root.cursor.pic 3._visible = false
_root.cursor.pic 4._visible = false
_root.cursor.pic 5._visible = true
}
onMouseDown = function()
{
if(type == 5)
{
type = 1
}
else
{
type += 1
}
}
}
}
also put in your mouse dragging code
@the arm:
yes, same way as for learner
@me mind explaining what each line of code does? i would like to understand how ur code works so that i may apply it in other methods in future. Thx in advance!
actually i realised that right clicking makes the original cursor appear again… how to fix that?