I would like to change mouse cursor to “pointer” or others whenever mouse is over particular sprites (either normal sprite, or menuitem) in cocos2d-html5 game. How can I do that?
I would believe it needs to bog down into library (.js) file and modify it in the time of creating a new sprite or menuitem. Any suggestions would be appreciated. Thanks ahead!
while you could use javascript to change the css browser icon on the fly, the cursor will not be changed untill a “mouseenter” event has being fired. in other word, the cursor must move outside the canvas and back in to the canvas to see the effect.
you could however import some cursor sprite, then hide your normal mouse, then move the mouse sprite every frame to your mouse location
Sorry for late reply guys, I switched to another stuff recently.
By the way,
Thanks Shengxiang Chen, it’s pretty much handy code. I didn’t have a chance to test it out yet but whenever I test it out I will get back to you.
Thanks Hao Wu as well for information.