How to Change the Cursor on a Hover in Flash CS3

If you are creating a flash application with buttons, it is important to change the mouse cursor when you hover over an interactive button or a link. When a mouse cursor changes (from a pointer to a hand cursor) it serves as a visual cue to the user that a button has interactivity attached to it. Without the change in the mouse cursor on a hover, the user might not realize that the button is meant to be clicked. Including a mouse cursor change on a hover is also an easy way to make your Flash movie more user-friendly

Things You'll Need

  • Adobe Flash Professional (CS3, CS4 or CS5 versions)
Show More

Instructions

    • 1

      Start the Flash program. Click "New" from the "File" menu on the main Flash menu bar. Click the file type "Flash File" (ActionScript 3.0) from the "New Document" dialog box that appears. Click the "OK" button to close this dialog box and start your flash cursor project.

    • 2

      Select the "Actions" option from the "Window" menu on the main Flash menu bar to open the "Actions" editor. Position your mouse cursor on the first line in the Action's editor and click your "left mouse button."

    • 3

      Type or copy and paste the code below into the Actions editor as the code that will create a red button (the hexadecimal code 0xFF0000 is the color code for red) that is positioned on the Flash stage at the grid location (200,200); has a width of 100 pixels (300 minus 200) and a height of 100 pixels (300 minus 200).

      var buttonCursor:MovieClip= new MovieClip();

      buttonCursor.graphics.lineStyle(1);

      buttonCursor.graphics.beginFill(0xFF0000);

      buttonCursor.graphics.drawRect(200,200,300, 300);

      buttonCursor.graphics.endFill();

    • 4

      Type on the next line of the "Actions" editor the code listed below to place the red button on the stage

      stage.addChild(buttonCursor);

    • 5

      Type the code as shown below on the next line of the Actions editor to change the cursor to a "hand cursor" from a mouse pointer cursor when the mouse cursor is positioned within the boundaries of the red button.

      buttonCursor.buttonMode = true;

    • 6

      Review and correct any syntax errors in the code you typed in as listed below. Copy and paste the code below into the Actions editor if you have not already typed the code in.

      var buttonCursor:MovieClip= new MovieClip();

      buttonCursor.graphics.lineStyle(1);

      buttonCursor.graphics.beginFill(0xFF0000);

      buttonCursor.graphics.drawRect(200,200,300, 300);

      buttonCursor.graphics.endFill();

      stage.addChild(buttonCursor);

      buttonCursor.buttonMode = true;

Learnify Hub © www.0685.com All Rights Reserved