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

Troubleshooting about mousemove in HTML5 Canvas

Community Beginner ,
Jun 25, 2019 Jun 25, 2019

var frequency = 50;

stage.enableMouseOver(frequency);

this.cursore.addEventListener("mouseover", MoverC.bind(this));

function MoverC() {

this.cursore.scurisciCursore.visible = true

}

this.cursore.addEventListener("mouseout", MoutC.bind(this));

function MoutC() {

this.cursore.scurisciCursore.visible = false

}

this.cursore.addEventListener("mousemove", MmoveC.bind(this));

function MmoveC(event) {

alert(event)

}

Why this code don't work only with "mousemove"?

628
Translate
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
Community Expert ,
Jun 25, 2019 Jun 25, 2019

See if this helps?

/* Mouse Over Event

Mousing over the symbol instance executes a function in which you can add your own custom code.

Instructions:

1. Add your custom code on a new line after the line that says "// Start your custom code" below.

The code will execute when the symbol instance is moused over.

frequency is the number of the times event should be triggered.

*/

var frequency = 3;

stage.enableMouseOver(frequency);

this.movieClip_1.addEventListener("mouseover", fl_MouseOverHandler);

function fl_MouseOverHandler()

{

// Start your custom code

// This example code displays the words "Moused over" in the Output panel.

alert("Moused over");

// End your custom code

}

/* Mouse Out Event

Mousing out of the symbol instance executes a function in which you can add your own custom code.

Instructions:

1. Add your custom code on a new line after the line that says "// Start your custom code" below.

The code will execute when the symbol instance is moused out of.

*/

var frequency = 3;

stage.enableMouseOver(frequency);

this.movieClip_1.addEventListener("mouseout", fl_MouseOutHandler);

function fl_MouseOutHandler()

{

// Start your custom code

// This example code displays the words "Moused out" in the Output panel.

alert("Moused out");

// End your custom code

}

/* Custom Mouse Cursor

Replaces the default mouse cursor with the specified symbol instance.

*/

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

this.movieClip_1.mouseEnabled = false;

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

function fl_CustomMouseCursor() {

this.movieClip_1.x = stage.mouseX;

this.movieClip_1.y = stage.mouseY;

}

//To restore the default mouse pointer, uncomment the following lines:

//this.removeEventListener("tick", fl_CustomMouseCursor.bind(this));

//stage.removeChild(movieClip_1);

//stage.canvas.style.cursor = "default";

Translate
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
Community Beginner ,
Jun 27, 2019 Jun 27, 2019
LATEST

The problem is:

I want to move a movieclip with my mouse when i click over this..

But i don't know how...

Translate
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