Flash Tutorials, Samples, Resources, Greetings, Games
Home | About Us | Resources | Tutorials | Links | Games | Movies | Projects | Feedback | Contact Us
Tutorials
Here you'll get tutorials for all skill levels wheather you are a new user or an expert flash developer.

» Enter
Resources
In this section you'll get some small movie clips which can be used in your flash projects with flash components, flash action scripts .as files and some other stuff that will help you in your flash projects. You can also submit your work here. For submit details please checkout our Submit Page.

» Enter
Games
Play and download great flash games. If you have any flash game, please send us, we will put it with your name.

» Enter
Movies
Flash FLA movies to download.

» Enter
Home » Tutorials



   Intermediate Level - Change Mouse Cursor
In this tutorial we will learn how to change mouse cursor to our own made custom cursor and change it back to default cursor in flash through action script.



In first phase we will do design work of the file. open a new flash file with dimenson 200x150. In this movie i have used three differenet cursors to show the custom cursors. So design 3 small movie clips that you would like to use as your cursors and give them name msc, msd and mse respectively. Place these movie clips on stage and give their instance names same as their names. Now to change the cursor we need some buttons on the click of which we will change our mouse cursors. so create four buttons, three for our custom cursors and one other for getting back our default cursor.

So we have completed the design work of Custom Cursor movie. This is all you want to design for this tutorial. Now get ready for the scripting part of the movie.

In the scripting part i will tell you the script of first button that will change our default cursor to custom cursor. So for this just select the first button and write this script in the action pannel.

on (release)    {
Mouse.hide();
startDrag(msc, true);
          }


Copy and paste this script on Button 2 and Button 3 also but remember to change msc in button 1 script to msd and mse for button 2 and button 3. So when we test our movie we will see that it's working but when select any other cursor the position of previous cursor gets changed. So for get this working we add these lines in our current script for button 1.

if (cs == "b")    {
msd._x = 100;
msd._y = 10;
      }   else if (cs == "c") {
mse._x = 140;
mse._y = 10;
        }
cs = "a";

What this script is doing is it's checking which cursor is currently selected and setting the positions of other cursors to their default positions. In the same way we can put this validation on button 2 and button 3.

On the default we will put the stopDrag() and mouse.show action with the validation of all three cursors. Refer .fla file if still in confusio what to write for Default button and on button 2 and button 3.


Download Final Fla file