# Listener for last frame

**URL:** <https://forum.kirupa.com/t/listener-for-last-frame/262428>\
**Category:** Uncategorized\
**Created:** [June 5, 2008, 8:41pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428 "2008-06-05T20:41:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 5, 2008, 8:41pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/1 "2008-06-05T20:41:59Z")

</div>

ok, i want to set a listener in my class that fires a function when (currentFrames==totalFrames) but i’m trying not to make my class heavy, and don’t want to set an enterFrame listener or timer listener, COMPLETE does not seem to do the trick, any creative ideas out there?(-:

---

<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, 8:45pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/2 "2008-06-05T20:45:28Z")

</div>

the only other option would be using addFrameScript

> **[ActionScript 3 Tip of the Day - Page 22](https://www.kirupa.com/forum/showthread.php?p=2098268)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 5, 2008, 8:56pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/3 "2008-06-05T20:56:10Z")

</div>

thanx that is interesting stuff!  
but i looks like it would be heavier that just using EnterFrame, is it?

---

<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, 11:20pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/4 "2008-06-05T23:20:45Z")

</div>

Why does it look heavier? It calls a function for that frame. That’s all it does.

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 6, 2008, 12:00pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/5 "2008-06-06T12:00:08Z")

</div>

ok your right, sorry.  
i just took a quick glance at it at the end of the day, and from a quick glance it looks like it would add more bytes to the file size, but maybe not, it does look like it is less memory intensive though and thats what im trying to go for.  
thanx sen you rawk!  
🍺

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 6, 2008, 12:09pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/6 "2008-06-06T12:09:28Z")

</div>

update, just added it and it’s working great, man that was like exactly what i was looking for!!!  
really your great thanks for the guidance!  
:party:

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 6, 2008, 12:23pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/7 "2008-06-06T12:23:27Z")

</div>

one more question, sorry  
does this  
addFrameScript[COLOR=#000000]([/COLOR][COLOR=#000080]2[/COLOR], [COLOR=#000000] **null** [/COLOR][COLOR=#000000])[/COLOR];  
remove the frame or just the addFrameEvent on that frame?  
now it’s time to make my destroy clean up function:sure:

---

<div class="post-metadata">

**Author:** ![GrndMasterFlash](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@GrndMasterFlash](https://forum.kirupa.com/u/GrndMasterFlash)\
**Post date:** [June 6, 2008, 12:38pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/8 "2008-06-06T12:38:53Z")

</div>

[quote=GrndMasterFlash;2337941]one more question, sorry  
does this  
addFrameScript[COLOR=#000000]([/COLOR][COLOR=#000080]2[/COLOR], [COLOR=#000000] **null** [/COLOR][COLOR=#000000])[/COLOR];  
remove the frame or just the addFrameEvent on that frame?  
now it’s time to make my destroy clean up function:sure:[/quote]  
**_EDIT_** \*\*  
never mind after doing some traceing i found out that it is does remove the listener and not the frame, cool, thanx agian

---

<div class="post-metadata">

**Author:** ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)\
**Post date:** [June 6, 2008, 3:06pm UTC](https://forum.kirupa.com/t/listener-for-last-frame/262428/9 "2008-06-06T15:06:25Z")

</div>

addFrameScript!! :love:

This is really interesting. Sometimes I really need to put some code on a frame and this way I could organize everything in just one accessible clean place.

Thx Senocular 😉
