# Removing event listener for external audio tracks?

**URL:** <https://forum.kirupa.com/t/removing-event-listener-for-external-audio-tracks/324403>\
**Category:** flash\
**Created:** [August 18, 2011, 9:15pm UTC](https://forum.kirupa.com/t/removing-event-listener-for-external-audio-tracks/324403 "2011-08-18T21:15:13Z")\
**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:** [August 18, 2011, 9:15pm UTC](https://forum.kirupa.com/t/removing-event-listener-for-external-audio-tracks/324403/1 "2011-08-18T21:15:13Z")

</div>

I have a site that has many pages, and almost everypage has an external audio track that is brought in using actionscript. (Creating an audio channel)

```auto

var isPlaying:Boolean = new Boolean();var pausePosition:Number = new Number();

//Create an instance of the Sound class
var daynaClip1:Sound=new Sound();

//Create a new SoundChannel Object
var d1Channel:SoundChannel=new SoundChannel();

//Load sound using URLRequest
daynaClip1.load(new URLRequest("audio/slide2_narrator.mp3"));

//Create an event listener that wll update once sound has finished loading
daynaClip1.addEventListener(Event.COMPLETE,onComplete,false,0,true);

function onComplete(evt:Event):void {
    //Play loaded sound
    d1Channel=daynaClip1.play();
	isPlaying = true;
	
}

```

This works perfectly, the sound starts playing and all.

**The Problem…**  
However it seems that sometimes on the site, when it is on the webserver, _and not when it is playing back locally_, some of these audio tracks will either continue playing after you leave the page, or sometimes, _many_ of them will start playing at the same time on a page where they should not be playing at all. I cannot figure out what would cause this.

My guess is I need to disable the eventlistener, so that after you leave the page, they _can’t_ trigger again until you come back to the page? But I do not know how to remove the event listener.

Is my assumption right? If so, how do I implement this? And if my assumption is wrong, does anyone have any suggestions of what to do to stop the audio from mysteriously playing where it shouldn’t be playing?
