我已经在Adobe Animate CC上创建了一个网站,我使用此代码片段完成了鼠标关注:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX;
this.plus_mc.y = stage.mouseY;
this.black_plus_mc.x = stage.mouseX;
this.black_plus_mc.y = stage.mouseY;
}
当我在发布设置中检查它是否响应时,跟随者没有与鼠标光标对齐,只有当我将光标定位在浏览器左上角时它才会对齐,然后当我移动光标时它会走远。
答案 0 :(得分:0)
我在ClayUUID发现了Adobe论坛的解决方案:
我将坐标分为stage.scaleX和scaleY。
这是正确的代码,使页面响应与光标跟随器对齐:
this.stage.canvas.style.cursor = "none";
this.mouseEnabled = true;
this.addEventListener("tick", fl_CustomMouseCursor.bind(this));
function fl_CustomMouseCursor() {
this.plus_mc.x = stage.mouseX / stage.scaleX;
this.plus_mc.y = stage.mouseY / stage.scaleY;
this.black_plus_mc.x = stage.mouseX / stage.scaleX;
this.black_plus_mc.y = stage.mouseY / stage.scaleY;
}
谢谢