Skip to content
Nov 25 / Peter deHaan

Displaying a hand cursor on a Button component in Flash with ActionScript 3.0

The following example shows how you can display a hand cursor when the user’s mouse is over the Button component instance by setting the useHandCursor property to true.

Full code after the jump.

// ActionScript 3.0
import fl.controls.Button;
 
var myButton:Button = new Button();
myButton.label = "useHandCursor = true";
myButton.width = 160;
myButton.move(10, 10);
myButton.useHandCursor = true;
addChild(myButton);

2 Comments

leave a comment
  1. rootfroot / Feb 6 2009

    There’s no such thing as a button in Actionscript 3. Replaced by SimpleButton.

  2. StrawMan / May 6 2009

    rootfroot:
    They most certainly do exist.
    The code above assumes a Button Component Instance, as cited, somewhere either in the library or on the stage.

    In a similar vein, if one is drawing buttons from scratch from movie clips, applying the following code will allow for the hand cursor:


    myClip_mc.buttonMode = true;
    myClip_mc.useHandCursor = true;

Leave a Comment