I'm using TweenLite class (AS3), I have very big project, should I removelistener of timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true); in Tweenlite.as file, after my animation is complete????
Because of big project, i'm affraid that ENTER_FRAME causes memory leak for my project.
Thank you
views:
13answers:
2
A:
Probably not, although you can always ask the question to Jack Doyle at greensock.com. What's your coding environment? Do you have a profiler? It would make more sense to run some tests and do some profiling before engaging in modifying TweenLite, especially since you have a big project.
By the way, your accept rate is pretty low, maybe you should fix that ;)
PatrickS
2010-10-11 04:47:03
You made me smile dude ;) Ok i will ask Mr Jack. I use flash cs4, codding in flashDeveloper. One question, there are hundreds of Tweenlite.to calls i make in my project, each of them do not have removelistener for updateAll function inside class, I think it's stupid :D What you think? Why probably i may skip removeListener as you say???
Almas Adilbek
2010-10-11 06:03:47
As a Mac user, I'm not familiar with FlashDevelop but I think FD has a profiler. If it does, I suggest you do a little profiling before worrying about memory leaks. If you can pinpoint issues with Tweenlite, then you should ask Jack ;) More seriously, note that the listener uses weakReference.
PatrickS
2010-10-11 07:32:21
A:
You do not need to remove the event listener manually.
The last argument, useWeakReference
is set to true so your object will get garbage collected even with the listener present.
Read more here: http://www.adobe.com/livedocs/flash/9.0/ActionScriptLangRefV3/flash/events/IEventDispatcher.html
grapefrukt
2010-10-11 07:29:46