The methods of the Mouse class are used to hide and show the mouse pointer, or to set the pointer to a specific style. The Mouse class is a top-level class whose properties and methods you can access without using a constructor. The pointer is visible by default, but you can hide it and implement a custom pointer.

Static variables

staticcursor:MouseCursor

Sets or returns the type of cursor, or, for a native cursor, the cursor name. The default value is openfl.ui.MouseCursor.AUTO.

To set values for this property, use the following string values:

String valueDescription
openfl.ui.MouseCursor.AUTOMouse cursor will change automatically based on the object under the mouse.
openfl.ui.MouseCursor.ARROWMouse cursor will be an arrow.
openfl.ui.MouseCursor.BUTTONMouse cursor will be a button clicking hand.
openfl.ui.MouseCursor.HANDMouse cursor will be a dragging hand.
openfl.ui.MouseCursor.IBEAMMouse cursor will be an I-beam.

Note: For Flash Player 10.2 or AIR 2.6 and later versions, this property sets or gets the cursor name when you are using a native cursor. A native cursor name defined using Mouse.registerCursor() overwrites currently predefined cursor types (such as openfl.ui.MouseCursor.IBEAM).

Throws:

ArgumentError

If set to any value which is not a member of openfl.ui.MouseCursor, or is not a string specified using the Mouse.registerCursor() method.

@:value(true)staticread onlysupportsCursor:Bool = true

Indicates whether the computer or device displays a persistent cursor.

The supportsCursor property is true on most desktop computers and false on most mobile devices.

Note: Mouse events can be dispatched whether or not this property is true. However, mouse events may behave differently depending on the physical characteristics of the pointing device.

@:value(true)staticread onlysupportsNativeCursor:Bool = true

Indicates whether the current configuration supports native cursors.

Static methods

statichide():Void

Hides the pointer. The pointer is visible by default.

Note: You need to call Mouse.hide() only once, regardless of the number of previous calls to Mouse.show().

staticshow():Void

Displays the pointer. The pointer is visible by default.

Note: You need to call Mouse.show() only once, regardless of the number of previous calls to Mouse.hide().