• home
  • forum
  • my
  • kt
  • download
  • Custom Cursor

    Author: 2008-09-26 09:18:55 From:

    This flash tutorial will teach you how to create a custom cursor in Macromedia Flash. Custom cursor are useful for games, websites and multimedia applications.


    Create a custom cursor in Flash

    Step 1


    Create a new flash document. Select any colour as your background.

    Step 2

    Draw your custom cursor on stage. I made a cross hair using the oval tool (O) and line tool (N) and fill the shape red. You can design whatever you wish.
    Make sure your cursor is an appropriate size.

    Step 3

    Take the selection tool (V) and highlight your custom cursor on the stage.

    Select F8 to convert it to a symbol.

    Choose an appropriate name and check the movie clip button and click Ok.





    Step 4

    Select the custom cursor and give it an instance name. eg. cursor_mc.





    Step 5

    Create a new layer on the time line and call it "actions".


    Right click on the 1st frame of the actions layer and select actions.



    Step 6

    Type the following code the in the actions box:

    Mouse.hide();

    cursor_mc.onMouseMove = function(){
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    updateAfterEvent();
    };


    **This small piece of code basically hides the existing cursor and replaces it with your custom cursor.


    Step 7

    Choose Ctrl + Enter to test movie.

    This flash tutorial is a continuation of previous custom cursor tutorial. I will be adding extra functionality to the prior custom cursor. The custom cursor will now change colour when the left mouse button is click. Only a few more lines of code are needed.

    You need to have completed the first part of the custom cursor tutorial before attempting this tutorial.

    Custom cursor part 2

    Step 1

    Open part 1 of your custom cursor flash document.

    Step 2

    Using the selection tool (v) double click on your custom cursor. Your timeline should change as you are now inside your cursors movie clip instance.



    Now on the timeline select F6 to insert a new key frame. And with your custom cursor selected change the stroke colour of your custom cursor to whatever colour you wish. I used a blue colour. If your custom cursor is a primitive shape then you can use the paint bucket tool to change the colour.



    Your timeline should look like below:



    Step 3

    Now double click anywhere on the stage to return to the main timeline.
    On the timeline select the action layer and right click on the 1st frame and select Actions. Then add the following code:

    stop();
    Mouse.hide();
    cursor_mc.gotoAndStop(1);
    cursor_mc.onMouseMove = function() {
    this._x = _root._xmouse;
    this._y = _root._ymouse;
    updateAfterEvent();
    };
    cursor_mc.onMouseDown = function() {
    this.gotoAndStop(2);
    };
    cursor_mc.onMouseUp = function() {
    this.gotoAndStop(1);
    };

    **Most of this code should look familiar. The only differences are the onMouse down & onMouse up functions. This extra code basically jumps to the frame where the cursor changes colour and returns when the cursor is release.


    Step 4

    Test your movie clip Ctrl + enter. Left Click anywhere on the stage and your custom cursor should change colour

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      3D (20)
      Math Physics (14)
      3rd Party (5)
      Navigation (60)
      Actionscripting (26)
      Optimization (16)
      Animation (32)
      Projector (9)
      Audio (46)
      Special Effects (112)
      Backend (25)
      Text Effects (65)
      Drawing (18)
      Tips and Techniques (41)
      Dynamic Content (25)
      Tricks (6)
      Games (66)
      Utilities (19)
      Getting Started (71)
      Video (10)
      Interactivity (35)
      Web Design (29)

    New

    Hot