Losing the Hand cursor in AS3.

I was recently working on a AS3 project and released towards the end, that none of my otherwise working buttons were displaying the standard hand cursor. I fixed it by calling the following in the client Class:

tickBoxButton.buttonMode = true;
tickBoxButton.useHandCursor = true;

What I really wanted to do, was to have the relevant code within the button Class itself. For example in the Class Constructor:

public function TestButton() {
this.useHandCursor = true;
this.buttonMode = true;

This will only work for instances which are instantiated by calling new TestButton(), not with those which are placed on the Stage Timeline. To create a Button Class that will cope with both case use the event:


( See for more information see the livedocs.adobe.)


package com.factornine.buttons {
import flash.display.MovieClip;
import flash.events.Event;

public class TestButton extends MovieClip{
public function TestButton() {
this.addEventListener(Event.ADDED_TO_STAGE, addedToStage);
* @param event the event has 4 properties:
* bubbles false
* cancelable false; there is no default behavior to cancel.
* currentTarget The object that is actively processing the Event object with an event listener.
* target

private function addedToStage(event : Event) : void {


private function evaluateHandCursorAndButtonMode() : void {
if(!this.useHandCursor) this.useHandCursor = true;
if(!this.buttonMode) this.buttonMode = true;


2 thoughts on “Losing the Hand cursor in AS3.

  1. Thanks for the tip. I’m making an e-learning flash app and that’s just the tip I was looking for.

    A related tip for handCursors, if you want a handCursor to display for just the thumb of a slider, use the following:

    Sprite(mySliderInstance.getChildAt(1)).useHandCursor = true;

    That was placed in the constructor for the main application class and only works for a slider on the timeline (in this example, named “mySliderInstance”), although it’d be easy to combine your technique and this one for dynamic slider instances as well.

  2. [English of a french guy]
    Cool ! I realy like your clear explaination.
    I don’t know why you created 2 methods addedToStage() and
    evaluateHandCursorAndButtonMode(). It can be usefull with a bigger context when you want to call evaluateHandCursorAndButtonMode() for others events. That is not the case in your exemple, and it’s not in my app neither so I moved the content of evaluateHandCursorAndButtonMode() in addedToStage() and deleted evaluateHandCursorAndButtonMode(). See :

    public class Bouton extends MovieClip {

    public function Bouton() {
    /* */
    this.addEventListener(Event.ADDED_TO_STAGE, gestionCurseur);

    protected function gestionCurseur(evt:Event) : void {
    if(!this.useHandCursor) this.useHandCursor = true;
    if(!this.buttonMode) this.buttonMode = true;

    Thank you. It works perfectly.
    [/English of a franch guy]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s