# Unloading a generic Movieclip completely

**URL:** <https://forum.kirupa.com/t/unloading-a-generic-movieclip-completely/232006>\
**Category:** flash\
**Created:** [July 10, 2007, 1:22pm UTC](https://forum.kirupa.com/t/unloading-a-generic-movieclip-completely/232006 "2007-07-10T13:22:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shabaz](https://avatars.discourse-cdn.com/v4/letter/s/ee7513/32.png) [@Shabaz](https://forum.kirupa.com/u/Shabaz)\
**Post date:** [July 10, 2007, 1:22pm UTC](https://forum.kirupa.com/t/unloading-a-generic-movieclip-completely/232006/1 "2007-07-10T13:22:05Z")

</div>

So I thought all the errors in my site were gone . . . I have certain generic sounds that play in a various dynamic clips. When I unloaded them their timelines continue in the background and trigger sounds long after they are gone.

The only examples I can find of unloading all streams when unloading a clip specifically name the instances of the sounds and netStreams.

I need to just clear all aspects of these dynamic clips without specifically referencing the instance names of their sub properties.

This is the direction I’m going in:

var clipLoader:Loader;

```auto
function closeAllStreams(evt:Event) {
	clipLoader.SoundMixer.stopAll;
}

clipLoader.loaderInfo.addEventListener(Event.UNLOAD, closeAllStreams);

function loadNextClip():void {
	if (clipLoader != null) {
		unloadClip();
	}
	clipLoader = new Loader();
	addChild(clipLoader);
	var clipName:URLRequest = new URLRequest(parent.nextClip);
	clipLoader.load(clipName);
	parent.transition_mc.gotoAndPlay("clear");
}

function unloadClip():void {

	var count:int = this.numChildren;
	for (var i:int = 0; i <count; i++) {
		this.removeChildAt(0);
		this.clipLoader.unload();
		//this.removeChild(clipLoader);
	}
}

```

Again, unloading a movie is a crucial part of Flash and Actionscripting. The lack of information out there on this is frightening.

PS the code above unloads the clip, but doesn’t destroy the clips timeline. I could simply stop the clip before unloading it. But I’m worried about that taking up too many resources.

Jake
