1 Reply Latest reply on Oct 2, 2008 7:08 AM by Newsgroup_User

    Weak referenes

    stigbn Level 1
      Hi all

      Are there any disadvantages with using weak references for eventlisteners ?
      That is, instead of doing this:

      obj.addEventListener(Event.CHANGE,someEventHandler);

      I would do this:

      obj.addEventListener(Event.CHANGE,someEventHandler,false,0,true);


      I know that I should ensure to unsubscribe all events, but using weakrefs would help garbage collection in case that I forget to unsubscribe some event handler.

      My question is:

      Does using weak references like this impose any performance overhead or other disadvantages ?

      And by the way, when adding event listeners in mxml code of a Flex app, are weak references then used ?

      Best regards S.Schmidt