# Running code 'on frame exit'?

**URL:** <https://forum.kirupa.com/t/running-code-on-frame-exit/307299>\
**Category:** Uncategorized\
**Created:** [April 1, 2010, 3:08am UTC](https://forum.kirupa.com/t/running-code-on-frame-exit/307299 "2010-04-01T03:08:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![HBK](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@HBK](https://forum.kirupa.com/u/HBK)\
**Post date:** [April 1, 2010, 3:08am UTC](https://forum.kirupa.com/t/running-code-on-frame-exit/307299/1 "2010-04-01T03:08:47Z")

</div>

trying to run some code when leaving the current frame…  
I assumed you could use Event.EXIT\_FRAME

but for example,

stop();  
if(Event.EXIT\_FRAME){  
trace(“hi”);  
}

‘hi’ gets output even though I haven’t exited the current frame (frame 1) ??

how do I achieve this ??
