On Wed, Jan 7, 2009 at 8:05 PM, Marco Catunda <[email protected]> wrote:
> I have some doubt about weak references at eventListener.
>
> When I add a eventListener with  weak reference true, the object don't
> get a "point/reference" to it but what happens with eventListener array after
> removing this object. This array don't has the reference for garbage collect,
> so the garbage collect could collect it, but this object was never removed
> from this eventListner array, wasn't it? That's my question. Is this object
> removed from eventlistener array when weak reference is true?
> Is it feasible to implement it in pure action script or It is a voodoo feature
> for compiler?

It is not a "voodoo" feature, if I understand what you mean. You can
create your own weak references in ActionScript to understand how it
works. Check out the WeakReference class:

http://manishjethani.com/using-weak-references-in-actionscript-3/

You're right -- when the last reference to the object has been
released, it is no longer in the dictionary, so there is indeed no way
to reach it. This means that the event listener is no longer listed as
listening for the event, so the event dispatcher no longer finds it,
it no longer notifies it of the event.

Manish

Reply via email to