|I l @ ve RuBoard|
In Hour 7, "Moving and Changing Movie Clips," you learned how to set a movie clip's location to the location of the mouse with the _xmouse and _ymouse properties. While the movie clip remains at the location of the cursor, it is not useful as a cursor because the real cursor stays visible. We can change this, however, by getting rid of the cursor altogether with the Mouse.hide() function.
By first using Mouse.hide() and then making a movie clip follow the cursor location, you can effectively create a custom cursor.
This cursor can be anything you want: your own stylized arrow, a hand, or something that fits the movie you are working on.
Figure 13.1 shows an example of a movie clip that will be used as a cursor. It is just a simple arrow. Notice that the graphic is positioned so that the crosshairs that signify the center of the movie clip are at the tip of the arrow. When we set the location of the movie clip, this spot will be placed at the position we specify. This is often called the hotspot of the cursor.
Figure 13.1. An example of a cursor movie clip.
If you want to switch from using a custom cursor back to the regular cursor, all you need to do is to use the Mouse.show() command to make the regular cursor visible again.
One last step in creating a custom cursor is to make sure that it appears on top of all the other movie clips. To switch the level of a movie clip, you can choose Modify, Arrange, Bring to Front. However, this only moves the movie clip above all other static movie clips on that layer. It does not move it above movie clips on other layers . Even if you placed the cursor movie clip in the top layer, it could still be behind movie clips created with ActionScript using the duplicateMovieClip and attachMovie commands.
To ensure that the movie clip is above all else, you will want to use the swapDepths command to bring the movie clip the very front.
The swapDepths command takes a movie clip and places it at a new level. A level can be any integer: 0, 1, 10, 9999, anything. If anything was at that level previously, it will now be at the former level of the other movie clip.
When you use the duplicateMovieClip or attachMovie commands, you specify a level for the new movie clip to reside. As long as these numbers are less than the level of the cursor movie clip, the cursor will always be on top. For instance, this command virtually ensures that the cursor movie clip stays on top:
|I l @ ve RuBoard|