Products
Technologies

Developer resources

Creating a hand cursor over a component

Avg. Rating 3.4

Problem

How do I change the mouse cursor to a hand when the mouse is over a particular Label or other component?

Solution

Set three properties on the component: useHandCursor=true, buttonMode=true, and mouseChildren=false.

Detailed explanation

You have a Label, and you want the mouse cursor shape to change to a hand whenever the mouse moves over that control.  You notice in the code hints that Label has a property called "useHandCursor", so you think your problem is solved:

<mx:Label useHandCursor="true" />
But oddly, that doesn't do the trick.

To get this to work, there are three properties of the control you have to set:

  • Set useHandCursor to true
  • Set buttonMode to true
  • Set mouseChildren to false
Like this:
<mx:Label useHandCursor="true" buttonMode="true"
mouseChildren="false" />

Once you do that, the hand cursor will appear every time the mouse moves over the label.  This works for most components, not just Label.

Report abuse

Related recipes