# Stop an ENTER\_FRAME event when you go to the next page?

**URL:** <https://forum.kirupa.com/t/stop-an-enter-frame-event-when-you-go-to-the-next-page/325129>\
**Category:** Uncategorized\
**Created:** [September 27, 2011, 9:34pm UTC](https://forum.kirupa.com/t/stop-an-enter-frame-event-when-you-go-to-the-next-page/325129 "2011-09-27T21:34:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lazerbrains](https://avatars.discourse-cdn.com/v4/letter/l/b19c9b/32.png) [@lazerbrains](https://forum.kirupa.com/u/lazerbrains)\
**Post date:** [September 27, 2011, 9:34pm UTC](https://forum.kirupa.com/t/stop-an-enter-frame-event-when-you-go-to-the-next-page/325129/1 "2011-09-27T21:34:15Z")

</div>

I have an ENTER\_FRAME event on one of my pages to create a progress bar for an audio track. It is working great, but I when I click on a button to goto the next frame, it continues to run the ENTER\_FRAME event continuously. I have many audio tracks in this project and need a progress bar for each. however, once a second one starts, it really begins to bog down the player.

Is there a way to stop an ENTER\_FRAME event from continuing after you leave a page? Here is the code i have:

```auto

import flash.events.Event;
tb_mc.scaleX = 0;

stage.addEventListener(Event.ENTER_FRAME,EnterFrame);
function EnterFrame(evt:Event):void {	
tb_mc.scaleX = audio_mc.currentFrame/audio_mc.totalFrames;
}

```

This makes a the MovieClip “tb\_mc” grow congruent to the MovieClip that holds the audio, “audio\_mc”

This works wonderfully, but when I click to go to the next page, the ENTER\_FRAME event continues to run. How can I stop it?
