Haxe Forum > Flash(10.2) native mouse cursor bug
-
Thomas Hortobagyi Apr 30 at 23:27
I wanted to use some bitmap for native mouse cursor in flash (it's a 10.2 feature), but the flash.ui.Mouse lib is not correct even in r3793 version.
Compared with Adobe's documentation there are 2 differences:1. Mouse.cursor's type is not MouseCursor, instead of String. But in Haxe this is not a good solution, because we need both of them, to switch to native cursor (String) and switch back to windows cursor (MouseCursor). So I use now like Dynamic, and it works both way. (I don't know how can I set a variable into two types.)
2. Mouse.registerCursor function needs two parameters: (name:String, cursor:MouseCursorData) and not one.
So here is the corrected Mouse.hx:
package flash.ui; extern class Mouse { @:require(flash10) static var cursor : Dynamic; @:require(flash10_1) static var supportsCursor(default,null) : Bool; static function hide() : Void; @:require(flash10_2) static function registerCursor(name : String, cursor : flash.ui.MouseCursorData) : Void; static function show() : Void; }
-
Roman Kudryashov May 02 at 22:21
thanks for this code snippet, implementing native cursors (haxe r3794)
slould mention that flash9/ui/MouseCursorData.hx also should be changed as MouseCursorData() takes no params:
so this line should be replacedfunction new(name : String) : Void;
withfunction new() : Void;