Mouse cursor on Cpp targets


Hi there !
Is there a way to change the mouse cursor on Cpp targets ?

It seems

Mouse.cursor = MouseCursor.BUTTON; 

only works on Flash target…

I can’t imagine no one ever had to use the hand cursor on windows or macosx targets… it seems such a simple way to make the user understand where he can click !


Try using buttonMode = true for a Sprite or useHandCursor = true for a SimpleButton :slight_smile:


…though I’m curious about this behavior. Once you set the Mouse.cursor manually, does Flash stop updating the cursor automatically? So a TextField doesn’t change to the text cursor, and it doesn’t change between the normal and hand cursors with buttons/sprites?


Thanks for your help, it seems a good point but… I’m using HaxePunk, and I’d like to switch cursor just over a specific zone of an Image (a graphic).
It’s not separated at all, and can’t be : it’s a kind of oldschool terminal typing text, and the link is just above one line (detecting mouse position and line position).

The best would have been to switch cursor, regardless of any object rollover.


Oh, I forgot – custom mouse cursors are supported in Lime 2, and therefore HTML5 and the “next” native target, but not on Lime 1 (legacy) which the C++ targets use by default right now


Oh, thanks for the intel.
It’s been bothering me for a while, but it’s not very important in the game I’m working on…
It can wait a few monthes for an update !

I might release my game this week on windows and macosx, and will post about it in the showcase section…
See you then :wink:


And is it possible to use custom cursor with cpp targets?

For flash i’m using haxefied version of this code:
How would you advise to replace it for desktops?


This is not supported at the moment, however, many standard cursors are supported. If you something custom, though, OpenFL is going to change the cursor back to whatever it needs by default (such as the pointer, hand or text cursors)

At the moment, I would recommend using a custom display object with your cursor, tracking the mouse position, and hiding the mouse. This should work fine cross-platform, and won’t be subject to changes from the OpenFL default cursor code :slight_smile:


Yep, this would be a good solution, unless it was framerate dependant…
So I was hoping there was a secret undocumented method present :slight_smile:


These are the cursors supported:

There is a “CUSTOM” value, but that’s TODO and not implemented yet :slight_smile:


So many changes since my last login, but no support for custom cursors yet :slight_smile:

Maybe in 2019? :slight_smile:


On C++, we would need to use this API:

For other targets, we would need to hide the cursor and drag a custom one. It might make more sense (at least for OpenFL) to consider supporting custom cursors (if we did) using the latter method, for cross-platform compatibility.

However, Flash has no API for creating a custom cursor, so from an OpenFL perspective, I’d say this is a WONTFIX

Open to suggestions for a way we would consider this from the Lime side


FYI, I managed to set a custom cursor on the HTML5 target by doing this :

var elem:js.html.Element = openfl.Lib.current.stage.window.element; = "url(\"myCursor.png\"), auto";


Oh, I did not see this API before:

So perhaps we could support cross-platform image-based cursors (though a basic white/black mask cursor might also be nice)


There was a way to use Native Cursor since flash 10.2

cursorVector = new Vector.<BitmapData>();
cursorVector[0] = cursorBitmapData;
cursorData = new MouseCursorData();
cursorData.hotSpot = new Point(0, 0); = cursorVector;
Mouse.registerCursor("myCustom", cursorData);
Mouse.cursor = "myCustom";