Help debugging code, "...must be a child of the caller"

I’m trying to load external swfs and use the same slider for each swf. I created a container, which is a Sprite, and then add the movieclips and slider to the container. However, when I click the nextButton I get:

  "ArgumentError: Error #2025: The supplied DisplayObject must be a child of the caller.
  at flash.display: DisplayObjectContainer/removeChild()
   at withSlider_fla::MainTimeline/nextSlid()"

If I take out the container.removeChild(test_mc) then each swf gets loaded but the previous one shows up and plays through. I need to be able to delete the previous swf so the user doesn’t see it. Any suggestions? My code is below, I can upload the fla if it would be more helpful. Thanks


import fl.controls.Label;
import fl.controls.Slider;
import fl.events.SliderEvent;
import flash.events.Event;
import flash.display.*;
import flash.net.URLLoader;


var vids:Array = new Array("intro.swf","ffs.swf","cap_high.swf","cap_low.swf","summary.swf");
var i:int=0;
var container:Sprite = new Sprite();
addChild(container);

var mySlider:Slider = new Slider();

function nextSlid(e:MouseEvent):void {
    if (i<vids.length-1) {
        flash.media.SoundMixer.stopAll();
        container.removeChild(test_mc);
        i++;
        Main(i);

    }

}
function prevSlide(e:MouseEvent):void {
    if (i>0) {
        flash.media.SoundMixer.stopAll();
        container.removeChild(test_mc);
       
        
        i--;
        Main(i);
    }
}

nextbtn.addEventListener(MouseEvent.CLICK, nextSlid);
prevbtn.addEventListener(MouseEvent.CLICK, prevSlide);

function Main(a:int):void {
    
    numSlide.text=(i+1)+"/"+vids.length;
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.INIT, loaded);
    loader.load(new URLRequest(vids[a]));
}

function loaded(event:Event):void {
    
    var test_mc:MovieClip=  MovieClip(event.target.content);
    trace(test_mc.totalFrames);
    container.addChild(test_mc);

    mySlider.addEventListener(SliderEvent.CHANGE, thumbDragHandler);
    mySlider.move(200,370);
    mySlider.width=200;
    mySlider.maximum=200;
    mySlider.liveDragging=true;
    container.addChild(mySlider);

    function thumbDragHandler(event:SliderEvent):void {
        var num:int= (mySlider.value/mySlider.width*test_mc.totalFrames)-1;
        test_mc.gotoAndPlay(num);
    }
    stage.addEventListener(Event.ENTER_FRAME, test);

    function test(e:Event):void {

        mySlider.value = mySlider.width * (test_mc.currentFrame/test_mc.totalFrames);
    }

}

Main(i);