In this tutorial, we’ll learn how to create a simple cursor in Flash without ’startDrag’ function.
First of all, create a new Actionscript 2.0 Flash file.
Draw the cursor you wish to use in your flash movie. It can be whatever you want it to be. I suggest leaving a small arrow in the top right corner so you know your actual position of the mouse in the movie. Convert it to a MovieClip and name it to whatever you want. Go into your MovieClip and make sure the tip of the mouse is exactly in the middle of the black cross. Go back to main scene and clip your mouse once (click the Flash Mouse). Press F9 for the actions panel. Add this code to the movieclip:
onClipEvent(enterFrame){
this._x = _root._xmouse;
this._y = _root._ymouse;
}
Also, if there is more than one frame in your main movie, add this to the first frame:
stop();
And if you want to hide the Mouse, use:
Mouse.hide();
Test the movie and your mouse should be the movieclip you created!
Download the sourcecode if you had any problem.
Related Posts:











4 Comments, Comment or Ping
Reece Fielding
Thanks Gabriel
Jul 30th, 2008
Gabriel Bianconi
I need to thank you for this tutorial.
Jul 30th, 2008
Edward Bentley
Also (though it can add lag), using “updateAfterEvent();” makes it smoother after the moving to the mouse code.
Jul 31st, 2008
Gabriel Bianconi
First of all, thanks for commenting.
To make it smoother, just increase the frame rate.
Jul 31st, 2008
Reply to “Creating a Custom Cursor”