removeChild? I want to remove the previous child before adding a new Child

I tinkered with AS3 a few months back, but don’t have ANY of the old scripts and can’t remember much.

I’m calling a method to add a new MovieClip to the Stage from the library, I’ve got that setup and working but each new instance overlay’s the old one and doesn’t replace.

I clearly need to removeMovieClip() but that is an AS2 function not AS3?

removeChild returns an error:

**
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at LukeSturgeon/loadPage()
at LukeSturgeon/navButtonHandler()
**

my two key functions are:

**
/**
* loadPage method
/
public function loadPage(page_str:String):void {
removeChild(page)
var page:MovieClip = getPage(page_str);
///
page.x = padding_left;
page.y = padding_top;
this.addChild(page);
}
/
*
* getPage method
*/
private function getPage(page_str):MovieClip {
var new_page:MovieClip;
///
switch (page_str) {
case “Profile” :
new_page = new Profile();
break;
case “Contact” :
new_page = new Contact();
break;
default :
new_page = new Work();
}
return new_page;
}

this version (minus the removeChild line) is viewable at http://www.lukesturgeon.co.uk/as3

any thoughts? it’s probably so simple!!!