# Listeners: Performance question

**URL:** <https://forum.kirupa.com/t/listeners-performance-question/262351>\
**Category:** flash\
**Created:** [June 5, 2008, 10:07am UTC](https://forum.kirupa.com/t/listeners-performance-question/262351 "2008-06-05T10:07:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ethernal](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@ethernal](https://forum.kirupa.com/u/ethernal)\
**Post date:** [June 5, 2008, 10:07am UTC](https://forum.kirupa.com/t/listeners-performance-question/262351/1 "2008-06-05T10:07:51Z")

</div>

I am trying to optimize my movie and I’m stuck with the following issue.

The movie has many options, each of them has initially set 3 listeners:

- MOUSE\_OVER
- MOUSE\_OUT
- CLICK

The question is: In performance terms, is better to set the 3 listeners initially or add and remove MOUSE\_OVER and MOUSE\_OUT inside of them? I mean:

mouseOverHandler:

- remove mouse over
- add mouse out

mouse out:

- remove mouse out
- add mouse over

---

<div class="post-metadata">

**Author:** ![sudhansurana](https://avatars.discourse-cdn.com/v4/letter/s/50afbb/32.png) [@sudhansurana](https://forum.kirupa.com/u/sudhansurana)\
**Post date:** [June 5, 2008, 10:19am UTC](https://forum.kirupa.com/t/listeners-performance-question/262351/2 "2008-06-05T10:19:22Z")

</div>

Don’t worry as3 is 10 times faster than as 2.0.No significant change in performance.

---

<div class="post-metadata">

**Author:** ![ethernal](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@ethernal](https://forum.kirupa.com/u/ethernal)\
**Post date:** [June 5, 2008, 11:40am UTC](https://forum.kirupa.com/t/listeners-performance-question/262351/3 "2008-06-05T11:40:28Z")

</div>

So If I want to optimize where can I make significant changes?

I have a big flv and it slows down depending on the computer and browser. Also I’m using TweenLite for some animations.

Any suggestion?

---

<div class="post-metadata">

**Author:** ![Alex\_Lexcuk](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Alex\_Lexcuk](https://forum.kirupa.com/u/Alex_Lexcuk)\
**Post date:** [June 5, 2008, 12:59pm UTC](https://forum.kirupa.com/t/listeners-performance-question/262351/4 "2008-06-05T12:59:48Z")

</div>

Test sdandart Tween.  
[http://murmadillo.tut.su/fla/tween\_event.swf](http://murmadillo.tut.su/fla/tween_event.swf)  
[http://murmadillo.tut.su/fla/tween\_event.zip](http://murmadillo.tut.su/fla/tween_event.zip)

[http://kind-armadillo.pochta.ru/FlaAC3/rain\_ac3.swf](http://kind-armadillo.pochta.ru/FlaAC3/rain_ac3.swf)

[http://kind-armadillo.pochta.ru/FlaAC3/rain\_ac3.rar](http://kind-armadillo.pochta.ru/FlaAC3/rain_ac3.rar)

[http://kind-armadillo.pochta.ru/FlaAC3/Mod\_rain\_ac3.swf](http://kind-armadillo.pochta.ru/FlaAC3/Mod_rain_ac3.swf)  
[http://kind-armadillo.pochta.ru/FlaAC3/mod\_rain\_ac3.rar](http://kind-armadillo.pochta.ru/FlaAC3/mod_rain_ac3.rar)

[http://kind-armadillo.pochta.ru/fla/deciduous.rar](http://kind-armadillo.pochta.ru/fla/deciduous.rar)  
[http://kind-armadillo.pochta.ru/fla/deciduous.swf](http://kind-armadillo.pochta.ru/fla/deciduous.swf)

---

<div class="post-metadata">

**Author:** ![senocular](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/senocular/32/7217_2.png) [@senocular](https://forum.kirupa.com/u/senocular)\
**Post date:** [June 5, 2008, 2:49pm UTC](https://forum.kirupa.com/t/listeners-performance-question/262351/5 "2008-06-05T14:49:29Z")

</div>

It would be redundant to remove the over on over and add it back in again on out. That’s just a lot of calls to addEventListener that don’t need to happen and additionally over complicates code.
