How to change the mouse cursor


I’ve just started using and haxe and so far it has been great. There is a pleasant balance between providing useful frameworks without requiring a more GUI driven approach.

However I have hit a problem … basically I want to turn off the cursor (hide) which I am doing with


This works great until I start using h2d.Interactive which changes the cursor when I go over the object. Fair enough and easily fixed with a

var interactive = new h2d.Interactive(100, 100, parent);
interactive.cursor = Hide;

Unfortunately when I leave the Interactive it reverts back to the default cursor so my cursor reappears (ie doesn’t stay hidden).

I’ve tried setting it to Hide again in the onOut of the Interactive however I believe this is called before the cursor is then set to Default (ie doesn’t work).

Some hunting around the code makes me believe this is because the SceneEvents is using the defaultCursor variable to reset it.

I can get at the SceneEvents via myApp.sevents but it doesn’t expose the defaultCursor.

In theory I can work around by skipping the h2d.Interactive and using



var scene: h2d.Scene = getScene();
if (scene != null) {

or something with InterativeScene’s

or just potentially hack the SceneEvents

However all of this feels like I’m reinventing Interactive or hacking.

Any pointers in the right direction would be much appreciated.


You can change the default cursor by exposing the private variables in h2d.Scene with this minimal example:

@:access(h2d.Scene) // Allows us to access
class Main extends hxd.App {
override function init() {
	Res.initEmbed(); = Cursor.Custom(new CustomCursor([Res.cursor.toBitmap()], 0, 4, 4));

static function main() {
	new Main();


By adding the @:access(h2d.Scene) at the top, you allow your class to access the private fields in the specified class.