Listeners!

Does anyone know how much memory/resources listeners take? That is if I create a bunch of listeners within my movie do I need to remove them after they aren’t needed anymore? Thanksssss for the help.

You dont ‘need’ to remove them, but it is good practise.

So it doesn’t hold on to memory like an onEnterFrame?

As long as there is a reference to the listener it will remain in the memory. Once you remove all references, Flash will delete the object from the memory. The more listeners there are, the more objects there are that the broadcaster has to, well, broadcast to. So it’ll help to clean up as much as you can but a few objects in the memory never hurt anyone/anything.

Am I right in assuming that they don’t take as much memory as onEnterFrames checking for items? That is it won’t bog down my flash movie to have say 5 listeners active in comparison to 5 onEnterFrames checking for similar activities.

I imagine it depends upon the interval at which the function is executed? If so, the only way setInterval would use more memory than oEF would be if the interval is less than your frame rate. :slight_smile:

EDIT: I’m an idiot. I thought this thread was about setInterval. Sorry!