Join The Community

Search

May 16, 2010

Custom Mouse Cursor in Flash

This tutorial will make little tutorial. Because we just need several script code to Custom Mouse Cursor in Flash. In previous Tutorial, I already making Mouse Cursor with Flash, that arrow as cursor. But the previous tutorial, I see the cursor so slow to respond while Mouse Over on the arrow.

Result

But in this tutorial, I will fixed, make cursor fully responded. Cause this script code make cursor fully control, you can import images as cursor, or you can create from Flash Tool Box. Ok, see this tutorial and see the videos for the best learn.

See The Videos!

1. Open your Flash (in this Tutorial, I use a new Flash CS5)

2. Choose ActionScript 3.0

Actionscript 3.0

3. In the Properties panel or you can right click and choose Document Properties, and change Width 400 px and Height 250 px.

Flash Properties Panel

Document Properties

Document Settings

4. After that, import image for background, click File > Import to Library.

Import to Library

5. In the Library Panel, drag the image to the stages.

Library Panel

Stages

Stage with Background

6. In the Timeline Panel, change the name of Layer 1 to “Background”.

Timeline Panel

And click Lock icon or click white point to locked the background.

Timeline Background

7. Click New Layer icon or click Insert > Timeline > Layer.

New Layer icon

Insert Layer

Change the name to “Cursor”.

Timeline Panel

8. Create the cursor with Rectangle Tool or you can import image as cursor. In this tutorial, click Rectangle Tool, make the cursor like cross.

Rectangle Tool

2 Rectangle

9. In the second Rectangle, right click, choose Free Transform, rotate the rectangle, see the pictures.

Free Transform

Make Cross

Cross in the stages

10. If finish, right click, choose Convert To Symbol.

Convert to Symbol

11. In the Convert To Symbol panel, don’t change anything, and click Ok.

Convert To Symbol Panel

12. Click the cross.

Stages

In the Properties panel, give the name of Movie Clipcursor_mc”.

Properties Panel

13. Click again New Layer icon or Insert > Timeline > Layer.

New Layer icon

Insert Layer

14. Change the name “Actionscript”. This use for saving the Flash Script.

Actionscript Layer

15. Still in the Actionscript panel, right click choose Action.

Action

16. When opened, give this script.

Action - Frame


Mouse.hide();
stage.addEventListener(MouseEvent.MOUSE_MOVE, moveThatMouse); function moveThatMouse(evt:MouseEvent):void {
    cursor_mc.x = stage.mouseX;
    cursor_mc.y = stage.mouseY;
    evt.updateAfterEvent();
}

17. After that, test the movies, click Control > Test Movie or press CTRL + Enter.

Test Movie

18. And we can see the result. You can create other cursor and added image as background without change the script, and when make the cursor, don’t forget to Convert as Movieclip and give the names “cursor_mc”.

Result






Share to Facebook Share to Twitter Share to MySpace Stumble It Share to Reddit Share to Delicious More...

0 comments:

Post a Comment