Skip to main content
Participating Frequently
April 21, 2023
Question

Custom cursor not working properly html5

  • April 21, 2023
  • 1 reply
  • 1114 views

Hello,

I have a client who wants a custom cursor and rollover effects. The rollovers work fine but the cursor is not. The default cursor is still being displayed and the custom cursor kind of responds in a weird way. Does anyone know why this is? If I were to take out the coding for the rollovers, the cursor works fine. Here is a link to what I am talking about:https://2shea.com/AFC/advocacy/advocacy_webpage.html.

The html5 code is below (The were lots of rollovers so I only included one rollover script to simplify). 

Thanks!

 

var _this = this;
stage.enableMouseOver(3);
_this.orange_button.on('mouseover', function () {
_this.orange_photo1.play();
});
var _this = this;
stage.enableMouseOver(3);
_this.orange_button.on('mouseout', function () {
_this.orange_photo1.play();
});
/* Custom Mouse Cursor
Replaces the default mouse cursor with the specified symbol instance.
*/
stage.canvas.style.cursor = "none";
this.pasted_purple_kid.mouseEnabled = false;
this.addEventListener("tick", fl_CustomMouseCursor_6.bind(this));

function fl_CustomMouseCursor_6() {
this.pasted_purple_kid.x = stage.mouseX;
this.pasted_purple_kid.y = stage.mouseY;
}

    This topic has been closed for replies.

    1 reply

    JoãoCésar17023019
    Community Expert
    Community Expert
    April 21, 2023

    Hi.

     

    Try setting the cursor property on the root to "none" and when you set the custom cursor position to the mouse position you have to take into account the stage scale. Like this:

    function fl_CustomMouseCursor_6() {
        this.pasted_purple_kid.x = stage.mouseX / stage.scaleX;
        this.pasted_purple_kid.y = stage.mouseY / stage.scaleY;
    }

     

    Please let us know the outcome.

     

    Regards,

    JC

    garydgAuthor
    Participating Frequently
    April 21, 2023

    OK. Thanks! I will try it. I am new to this so bear with me if I don't follow the directions properly.