# removeChild Only if Something Is There Already

**URL:** <https://forum.kirupa.com/t/removechild-only-if-something-is-there-already/239141>\
**Category:** flash\
**Created:** [September 19, 2007, 12:46am UTC](https://forum.kirupa.com/t/removechild-only-if-something-is-there-already/239141 "2007-09-19T00:46:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alemieux34](https://avatars.discourse-cdn.com/v4/letter/a/7ea924/32.png) [@alemieux34](https://forum.kirupa.com/u/alemieux34)\
**Post date:** [September 19, 2007, 12:46am UTC](https://forum.kirupa.com/t/removechild-only-if-something-is-there-already/239141/1 "2007-09-19T00:46:59Z")

</div>

I have some buttons that are loading external SWF files into a movie clip called holder. Each button loads SWFs into that clip, but the addChild method puts one on top of the other in sequence. How can I use removeChild to remove specifically, the content of the holder clip?

I have seen this: if (this.contains(ball)) this.removeChild(ball); But it doesn’t serve my purposes because the movie clip is a placeholder. Here’s my code:

```auto
b1.addEventListener(MouseEvent.CLICK, swf1);
function swf1(event:MouseEvent):void {
	var swf1Ldr:Loader = new Loader();
	var swf1URL:String = "dieHard.swf";
	var swf1URLReq:URLRequest = new URLRequest(swf1URL);
	swf1Ldr.load(swf1URLReq);
	swf1Ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swf1Loaded);
	function swf1Loaded(event:Event):void {
		holder.addChild(swf1Ldr.content);
	}
	// Make the progress clip visible and show the progress loaded
	swf1Ldr.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, showProgress);

}

```

Any ideas
