Hello Flash lovers and welcome to another tutorial. In this tutorial, we are going to make an animated custom cursor in Flash with ActionScript 3.
This is an example of what we will make.
Open up a new Action script 3 file. First we are going to import a small image for our new mouse pointer.
Now convert it to a movie clip.
Give it an instance name so we can deal with it from ActionScript 3.
Press F9 and type this code.
I will repeat it for lazy people who just want to copy it.
Mouse.hide();
stage.addEventListener(MouseEvent.Mouse_Move,follow);
fnction follow (evt:MouseEvent){
crs. x = mouseX;
crs.y= mouseY;
}
For those who are interested in learning, Hi again.
the Mouse.hide() function basically hides the mouse and if you want to show your mouse use Mouse.show() just like that.
Then we set up a fairly simple event listener for an event, for when the mouse moves. And everytime it does, we're going to make our movie clip follow it.
fnction follow (evt:MouseEvent){
crs.x = mouseX;
crs.y= mouseY;
}
This code says that every time you enter the frame, then the movie clip's position on the stage (csr.x and csr.y) will equal the x and y position of the mouse on the stage.
Well, thank you for reading this, and I hope you've learned something from it, you will find all the work
here http://www.megaupload.com/?d=6R0F8H5A
See you next time.
Mazen :)
Aucun commentaire:
Enregistrer un commentaire