No one call can remove all listeners.  No one call can remove all
references, just one at a time.
 
If you add a listener on yourself, there is no need to remove it.  It
might slightly help if it is a DRC object, but eventually it will be
garbage collected.
 
a.addEventListener("foo", b.someMethod) creates a reference from a to b,
not the other way around.

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of flexaustin
Sent: Thursday, August 07, 2008 10:27 AM
To: [email protected]
Subject: [flexcoders] Garbage Collection and event listeners



Is possible to remove all event listeners by doing something like the
following?

mc.removeEventListener(*,*,false);

Though not sure how you would get the count of eventlisteners or
iterate through them?

And as far as deleteing any reference to an object can you override
removechildren and add
for(var i:int=0; i<this.numChildren-1; i++) 
{ var chld:DisplayObject = this.getChildAt(i); 
chld.deleteReferenceOnParentDocument(this.parent);
}

Or is there a best practice when for when you write code like this:
addEventListener(ChildEvent.CHILD_ADDED,
handleAdd);

To override the removeChilden function to remove the event listener
above?

Thanks in advance.

--JDog



 

Reply via email to