// If you want to remove an event, you have to pass EXACTLY the same
function reference as you
// passed when adding the event, so you need to bind it first and keep
a reference to the bound
// function.
function OverPartner() {
// when you bind a function to an object, you are specifying what
the 'this'
// is in the scope of the bound function. In this case, it is
your item object.
alert(this.id);
}
var boundFunction = OverPartner.bind(item);
item.addEvent('mouseenter', boundFunction);
item.removeEvent('mouseenter', boundFunction);
On 19-Sep-08, at 12:58 AM, [EMAIL PROTECTED] wrote:
I have a simple Event
var func_over = function OverPartner(id)
{
alert();
}
and I add this event to en element
item.addEvents({
'mouseenter': func_over.pass([item.id])
});
after that i want to remove this event from the element, then i wrote:
it.removeEvent('mouseenter', func_over);
but the Event still work, (the remove event fail)
How can i do it? or what the mistake in the above code?