Copy link to clipboard
Copied
Hi, this is not working and i don't understand why.
First i add an eventlistener
var couverture_out=rollout.bind(this,'couverture');
this.couverture.addEventListener("mouseout",couverture_out);
then, i want to remove it on a click on the object
this.couverture.addEventListener("click", obj_bon.bind(this,'couverture'));
function obj_bon(obj) {
var obj_out = [obj]+"_out"; /* give 'couverture_out' */
this[obj].removeEventListener("mouseout", obj_out);
}
this[obj].removeEventListener("mouseout", obj_out);
should give
this.couverture.removeEventListener("mouseout",couverture_out) but that is not working, mouseout is still active
thanks for your help
use:
this.couverture_out=rollout.bind(this,'couverture');
this.couverture.addEventListener("mouseout",this.couverture_out);
this.couverture.addEventListener("click", obj_bon.bind(this,'couverture'));
function obj_bon(obj) {
this[obj].removeEventListener("mouseout", this[obj+"_out"]);
}
though this can be done more easily use the event's currentTarget.
Copy link to clipboard
Copied
use:
this.couverture_out=rollout.bind(this,'couverture');
this.couverture.addEventListener("mouseout",this.couverture_out);
this.couverture.addEventListener("click", obj_bon.bind(this,'couverture'));
function obj_bon(obj) {
this[obj].removeEventListener("mouseout", this[obj+"_out"]);
}
though this can be done more easily use the event's currentTarget.
Copy link to clipboard
Copied
Thanks a lot,kglad, and i thinks i undestand better the way it's working know.
all the best
Gilles
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now