In level 2, there is a function named
detachEvent is the equivalent of it in Internet Explorer's model).
This function allows one to remove an event listener. It only needs the type of the event (as a string) and the listener to be removed.
Unfortunately, every time you pass a reference to a function, the haXe compiler creates a closure. Closures are like functions enclosing functions and as such, the reference you pass to
addEventListener and the one you pass to
removeEventListener will never be equal, resulting in the
removeEventListener function not being able to remove the listener.
This can be tested in a very simple way.
Create an HTML file with the markup for two buttons and load ...