One extra point. I realize that if I use the
addEventListener("blahEvent", myFunc) function I need to remove those.
Even if I use weak reference I should remove it explicitly when I'm
done with the listener rather than waiting for GC.
Dale
--- In [email protected], "dbronk" <[EMAIL PROTECTED]> wrote:
>
> Subject is a bit confusing.
>
> What I'm asking is, for example, let's say that I have a component
> where I code creationComplete="onCreationComplete()". Should I make
> sure that in the onCreationComplete function do a
> this.removeListener(FlexEvent.CREATION_COMPLETE, onCreationComplete)?
>
> I guess my real question is that if I don't, does that leave an open
> listener lying around that can never be called again?
>
> Same question for custom events. If I have a component that
> dispatches "someEvent" and I have mxml that does
>
> <comps:MyComp someEvent="onSomeEvent(event)" />
>
> And the design of this is that someEvent will ever be dispatched a
> single time in it's existence should I call removeEventListener in my
> onSomeEvent function?
>
> I have written the following in my onSomeEvent function:
>
> var hasEvent : Boolean = this.hasEventListener("someEvent");
>
> this.removeEventListener("someEvent", onSomeEvent);
>
> hasEvent = this.hasEventListener("someEvent");
>
>
> The results of this is that hasEvent is true both before and after I
> call the removeEventListener.
>
> Along with this, is there a way to see if there is a specific
> listener? I mean currently I am only checking if there is a listener
> on that event, not that event and that function.
>
> Thanks,
> Dale
>