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

by Peter deHaan on November 25, 2008

in Button

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… read them below or add one }

1 rootfroot 02.06.09 at 2:18 am

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

2 StrawMan 05.06.09 at 10:37 pm

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

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: