# Exiting onclipevent

**URL:** <https://forum.kirupa.com/t/exiting-onclipevent/329691>\
**Category:** flash\
**Created:** [October 2, 2012, 10:19pm UTC](https://forum.kirupa.com/t/exiting-onclipevent/329691 "2012-10-02T22:19:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanek](https://avatars.discourse-cdn.com/v4/letter/z/db5fbb/32.png) [@zanek](https://forum.kirupa.com/u/zanek)\
**Post date:** [October 2, 2012, 10:19pm UTC](https://forum.kirupa.com/t/exiting-onclipevent/329691/1 "2012-10-02T22:19:48Z")

</div>

Hi

I was wondering how I could exit an onclipevent handler. I have a game where I want to make it so that you can run out of gas. But so far I am having problems, and the person who is teaching me flash told me that I needed a function to exit the clip event handler. I could only find escape(), which is for actionscript 1 and I am using 2.0. Here is what I have so far:  
onClipEvent(enterFrame){  
if(gas\<0){  
gotoAndPlay(“nogas”);  
trace(“No More Gas”);  
}  
}

The trace works, but the gotoandplay doesn’t

Thanks, Zane
