# Listeners!

**URL:** <https://forum.kirupa.com/t/listeners/184695>\
**Category:** flash\
**Created:** [April 6, 2006, 9:42pm UTC](https://forum.kirupa.com/t/listeners/184695 "2006-04-06T21:42:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![pizzapancakes](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pizzapancakes/32/2324_2.png) [@pizzapancakes](https://forum.kirupa.com/u/pizzapancakes)\
**Post date:** [April 6, 2006, 9:42pm UTC](https://forum.kirupa.com/t/listeners/184695/1 "2006-04-06T21:42:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 6, 2006, 9:46pm UTC](https://forum.kirupa.com/t/listeners/184695/2 "2006-04-06T21:46:52Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pizzapancakes](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pizzapancakes/32/2324_2.png) [@pizzapancakes](https://forum.kirupa.com/u/pizzapancakes)\
**Post date:** [April 6, 2006, 9:48pm UTC](https://forum.kirupa.com/t/listeners/184695/3 "2006-04-06T21:48:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)\
**Post date:** [April 6, 2006, 9:52pm UTC](https://forum.kirupa.com/t/listeners/184695/4 "2006-04-06T21:52:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pizzapancakes](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pizzapancakes/32/2324_2.png) [@pizzapancakes](https://forum.kirupa.com/u/pizzapancakes)\
**Post date:** [April 6, 2006, 10:27pm UTC](https://forum.kirupa.com/t/listeners/184695/5 "2006-04-06T22:27:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![B\_L\_U\_E](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@B\_L\_U\_E](https://forum.kirupa.com/u/B_L_U_E)\
**Post date:** [April 6, 2006, 10:40pm UTC](https://forum.kirupa.com/t/listeners/184695/6 "2006-04-06T22:40:10Z")

</div>

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. 🙂

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