How to Replace a Flash Cursor With AS3

ActionScript 3 gives you control over the mouse cursor icon that displays when a user hovers over a button, link or image. Use the "Mouse" class to change the cursor icon in the event listener for your Flash element. The cursor can be a standard Windows cursor or a custom cursor you designed for the animation file.

Instructions

    • 1

      Open your ActionScript editor and the Flash project you want to edit. Double-click the page you want to use to change the cursor.

    • 2

      Connect the event handler with the cursor function. The following code changes the cursor when a user hovers over a button:

      button.addEventListener(MouseEvent.ROLL_OVER,hover);

    • 3

      Create the function that changes the cursor. The following code uses the "Mouse" class to change the cursor:

      function hover(e:MouseEvent):void {
      Mouse.cursor="hand";
      }

      This code changes the icon to the "hand" icon when a user hovers over the button.

Related Searches:

References

Comments

Related Ads

Featured