var frequency = 3;
stage.enableMouseOver(frequency);
this.bigButton.addEventListener("mouseover", mouseOverFunction);
this.bigButton.addEventListener("mouseout", mouseOutFunction);
function mouseOverFunction() {
canVas.addEventListener("mousemove", setMousePosition, true);
function setMousePosition(e) {
mouseX = e.clientX - canvasPos.x;
mouseY = e.clientY - canvasPos.y;
context.beginPath();
context.arc(mouseX, mouseY, 50, 0, 2 * Math.PI, true);
context.fillStyle = "#FF6A6A";
context.fill();
}
}
function mouseOutFunction(){
canVas.removeEventListener("mousemove", setMousePosition, true);
alert("Trace");
}
can anyone tell me why the removeEventListener doesn’t work here? this code is in an adobe animate html5 canvas project. what i’m trying to accomplish is have a movie clip follow the mouse when hovering over a button, and then on mousing out of the button, have the setMousePosition stop and the movie clip go away.