• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Custom Cursor HTML5 Error

New Here ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

Just recently I have been having issues with custom cursors. In the top left of my canvas, the cursor works perfectly. The farther I move my mouse from there, the farther my custom cursor goes away from where my cursor should be. I've provided a video showing what I mean. In a project I am working on currently the cursor was functioning perfectly. I didn't touch the movie clip or the code and suddenly it started doing the same thing as test movie below. I did update to the newest version of Animate between the cursor working fine and having this bug. Additionally, I tried creating a drag and drop but the same error happens with what I'm trying to drag. The object drifts away from the cursor. Testing this issue, it seems to only be a problem for mac users, maybe just by coincidence?

This is my code:

stage.canvas.style.cursor = "none";

this.wand.mouseEnabled = false;

this.addEventListener("tick", fl_CustomMouseCursor_2.bind(this));

function fl_CustomMouseCursor_2() {

this.wand.x = stage.mouseX;

this.wand.y = stage.mouseY;

}

*I recently updated to the 16.5.1 release.

Views

1.7K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Sep 12, 2017 Sep 12, 2017

The stage itself has a scale. Try dividing the stage.mouseX by the stage.scaleX (not simply dividing by 2).

Votes

Translate

Translate
Contributor ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

While you shouldn't have to update the code to get it to work again, but for now you could try multiplying the stage.mouseX and stage.mouseY values by 2. The reason why something doesn't work anymore usually pop up eventually so it's good to be able to move on until then.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 12, 2017 Sep 12, 2017

Copy link to clipboard

Copied

The stage itself has a scale. Try dividing the stage.mouseX by the stage.scaleX (not simply dividing by 2).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

Colin! This worked really well on my computer but now the others that were not having issues with the file are only able to drag the custom cursor halfway across the stage. Do you have any idea why we are having the issue only on a few computers?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 14, 2017 Sep 14, 2017

Copy link to clipboard

Copied

There is another thing that may be important, if your custom cursor is inside a movieclip you may need to convert the global x and y to a local x and y value. See this:

EaselJS v0.8.2 API Documentation : DisplayObject

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2020 Apr 06, 2020

Copy link to clipboard

Copied

LATEST

Hi, I'm french and I have the same problem but I don't know where you find this code and how do I do to modify it to make it work !

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines