• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Hour 13. Rollovers > Task: Full-Time Custom Cursor

Task: Full-Time Custom Cursor

So what if you want to replace the cursor throughout the entire Flash movie. This is the easiest case. All you need to do is place a cursor movie clip across all the frames of your movie and attach a script to it.

Start with a new Flash movie.

Create a movie clip to replace the cursor. You can use a simple arrow. Be sure to position the arrow within the movie clip so that the crosshairs are at the tip as shown in Figure 13.1.

Back at the root level, start building a script for the movie clip. This begins with code to hide the real cursor and move this movie clip to the front:

onClipEvent(load) {
    // hide the real cursor

    // bring this movie clip to the front

The script continues with the main enterFrame handler. This positions the movie clip to where the cursor would have been:

onClipEvent(enterFrame) {
    // follow the mouse
    this._x = _root._xmouse;
    this._y = _root._ymouse;

The last part of the movie clip script restores the real cursor when the movie clip ends. If your movie truly uses the custom cursor during the entire movie, you will never need this. However, if you only place the cursor movie clip on some of the frames, this is necessary or you will leave the user without any cursor at all.

onClipEvent(unload) {
    // show the real cursor again

Test your movie or look at 13fulltimecursor.fla.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint