[flexcoders] removeEventListener - is it important?

2010-06-02 Thread Nick Middleweek
Hi, I'm trying to get my head into the Flex (3) component architecure and am reading through the source code of mx.controls.DateField. I've noticed quite a calls (eight of them) to addEventListener but there are none to removeEventListener. Is it not important to clear up after yourself?... It

Re: [flexcoders] removeEventListener - is it important?

2010-06-02 Thread Oleg Sivokon
If you are adding handlers to events dispatched by the objects that are going to be removed along with the listener, then why not? However, it is true that Flex components have no dispose() or similar methods.

Re: [flexcoders] removeEventListener - is it important?

2010-06-02 Thread Nick Middleweek
Hi Oleg, Thanks for the reply... I think it's important too but can't understand why the DateField Class in the Flex SDK doesn't do it? Digging a little deeper... Here's the Constructor of the DateField... /** * Constructor. */ public function DateField() { super();

Re: [flexcoders] removeEventListener - is it important?

2010-06-02 Thread Oleg Sivokon
Well, it's really hard to tell since all those objects inherit from UIComponent and it has almost every method overridden and to tell you the truth I just don't know what happens when these handlers are added or removed. I think in every particular case only the profiler will tell what is really

Re: [flexcoders] removeEventListener - is it important?

2010-06-02 Thread Alex Harui
A.addEventListener(“someEvent”, B.someHandler) Adds a reference from A to B so that A can know the which object’s someHandler to call. If A and B are the same or B is a child of A it can’t cause a memory leak and thus the listener does not need to be removed. If A is a parent of B or is