Flash MX - Custom Cursor - Ari Efendi

Advertisement

ads

Hot

Post Top Ad

Your Ad Spot

Saturday, January 1, 2011

Flash MX - Custom Cursor

This is a pretty simple tutorial to teach you how to make a custom cursor for your Flash movie. It consists of a movie clip and a little bit of Actionscript, that's it. For the Actionscript I'll walk through it in Normal Mode. For those that prefer Expert Mode, I'll provide the code for you to copy and paste right in.

The first thing you need to do is create a movie clip which will be your cursor. Go to Insert > New Symbol, give it a Name of cursor and make sure Movie Clip is selected as the Behaviour. Now create your cursor in this new MC. I simply created a triangle and rotated it a bit. The center of the MC is where your hidden cursor would be, so position the cursor you made accordingly. I positioned the point of my triangle at the center (crosshair) of my MC.

Now go back to your main stage and drag the new MC on to the stage. Right click the MC, select Actions. Click the + button and go to Objects > Movie > Mouse > Methods and select hide.

To activate the cursor, go to Actions > Movie Clip Control and select startDrag. For the target, put this and check the Expression box. Check the box for Lock mouse to center. If you want to limit the cursor movement to only a certain part of your movie, check the box for Constrain to rectangle and enter your values. If you use the Info panel (Window > Info), you can find your coordinates. The final code should look like this, with L, T, R and B the constraint values:

onClipEvent (load) {
Mouse.hide();
startDrag(this, true, L, T, R, B);
}

Test your movie. If all went well then you should end up with something similar to this.

Post Top Ad

Your Ad Spot