Skip to content
Nov 15 / Sidney de Koning

Changing the native cursor in FP10

I just found out you can natively change the mouse cursor in Flash.
This is handy if you want to have a different cursor when going over specific buttons or other DisplayObjects and don’t want to mess about with attaching clips to your mouse position.

For documentation please go here
Below is some quick code and an example:

_arrow.addEventListener( MouseEvent.MOUSE_OVER, arrowOver );
_button.addEventListener( MouseEvent.MOUSE_OVER, buttonOver );
_hand.addEventListener( MouseEvent.MOUSE_OVER, handOver );
_iBeam.addEventListener( MouseEvent.MOUSE_OVER, beamOver );

_arrow.addEventListener( MouseEvent.MOUSE_OUT, function(e:MouseEvent){Mouse.cursor = MouseCursor.AUTO; } );
_button.addEventListener( MouseEvent.MOUSE_OUT, function(e:MouseEvent){Mouse.cursor = MouseCursor.AUTO; } );
_hand.addEventListener( MouseEvent.MOUSE_OUT, function(e:MouseEvent){Mouse.cursor = MouseCursor.AUTO; } );
_iBeam.addEventListener( MouseEvent.MOUSE_OUT, function(e:MouseEvent){Mouse.cursor = MouseCursor.AUTO; } );

function arrowOver(e:MouseEvent):void {
Mouse.cursor = MouseCursor.ARROW;
}
function buttonOver(e:MouseEvent):void {
Mouse.cursor = MouseCursor.BUTTON;
}
function handOver(e:MouseEvent):void {
Mouse.cursor = MouseCursor.HAND;
}
function beamOver(e:MouseEvent):void {
Mouse.cursor = MouseCursor.IBEAM;
}

Please consider to buying me a coffee.

3 Comments

Leave a comment
  1. jankees / Nov 16 2009

    cool, but why do you put it in a Array?

  2. Sidney de Koning / Nov 16 2009

    No reason actually, ill clean up the code :)

  3. Jake / Mar 8 2010

    Thanks. Now if only Adobe would add more cursors.

Leave a comment