flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik de Bruin <e...@ixsoftware.nl>
Subject Re: [FLEXJS] RemoveEventListener
Date Sun, 04 Jan 2015 14:16:14 GMT
In Closure, 'addEventListener' is deprecated. Use 'goog.events.listen'
instead. The latter takes an 'opt_handler' as 5th argument, making the
use of 'goog.bind' unnecessary. It also returns a 'key', which you can
use with 'unlistenByKey'. If you don't want to do that, just use
'unlisten' with the same arguments as you used with 'listen'.

EdB



On Fri, Jan 2, 2015 at 9:37 PM, Alex Harui <aharui@adobe.com> wrote:
> Erik (and others).
>
> Do we know for sure whether removeEventListener works for FlexJS with
> goog.bind()?  I think I just stepped into it and it didn’t work because
> for code like this:
>
>       e.addEventListener(“foo", goog.bind(this.handler, this));
>       <more code>
>       e.removeEventListener(“foo", goog.bind(this.handler, this));
>
> goog.bind() will return a different “closure” on the second call to
> goog.bind() so it won’t be found as a listener.
>
>
>
> Thanks,
> -Alex
>



-- 
Ix Multimedia Software

Jan Luykenstraat 27
3521 VB Utrecht

T. 06-51952295
I. www.ixsoftware.nl

Mime
View raw message