HTML5 canvas , animated cursor within an event


hello , name etienne deswattenne , i'm flash beginner france apologize poor english , question following , how can change cursor scene symbol when mouse on symbol ? have "this" problem think

 

here code sketched in html5 canvas :

========================================================

bonjour tous et toutes , je ne comprends pas comment utiliser le mot clef "this" pour faire marcher ce bout de code , parce que la fonction est dans une autre fonction donc le 'this' ne se refere pas la meme chose ?? j'ai essayé pendant 4 heures j'ai rien trouvé, merci de m'aider!

=========================================================

 

var frequency = 3;

stage.enablemouseover(frequency);

this.zoneinterdite.addeventlistener("mouseover", fl_mouseoverhandler_17);

 

function fl_mouseoverhandler_17()

{

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

this.movieclip_6.mouseenabled = false;

this.addeventlistener("tick", fl_custommousecursor_15.bind(this));

 

function fl_custommousecursor_15() {

    this.movieclip_6.x = stage.mousex;

    this.movieclip_6.y = stage.mousey;

}

 

}

you lost reference 'this' in fl_mouseoverhandler_17.  (and shouldn't next named functions.)

 

try:

 

 

var frequency = 3;

stage.enablemouseover(frequency);

this.zoneinterdite.addeventlistener("mouseover", fl_mouseoverhandler_17.bind(this));

 

function fl_mouseoverhandler_17()

{

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

this.movieclip_6.mouseenabled = false;

this.addeventlistener("tick", fl_custommousecursor_15.bind(this));

 

 

}

function fl_custommousecursor_15() {

this.movieclip_6.x = stage.mousex;  // though these 2 lines end zoneinterdite mouseover

this.movieclip_6.y = stage.mousey;

}



More discussions in Adobe Animate CC - General


adobe

Comments

Popular posts from this blog

Illustrator CS6 Ocurrío un error E/S en el archivo.

Why is os_ViewContainer running?

Sudden Missing Sequence Presets