Captivate swf to close when its done playing

I’ve developed a menu in AS3 with about 10 buttons. Each buttong will load an swf or a swf created in Captivate. I want the swf to load ontop of the menu, then close when it’s done playing. I can get this to work fine with swfs created in Flash, but not captivate 5. The captivate file will open and play, but it won’t close.

I tried adding the script at the bottom to an swf and importing that into the last slide of captivate with no luck.

Any help? This doesn’t seem like it should be so tricky.

Here is some of the AS3. I didn’t bring the code in for all the buttons.

var swfLoader:Loader = new Loader;
introduction_to_gcssj_btn.addEventListener(MouseEvent.CLICK, introductionClicked);
portal_features_btn.addEventListener(MouseEvent.CLICK, portalFeaturesClicked);
basics_of_gcssj_btn.addEventListener(MouseEvent.CLICK, basicsClicked);
master_scenario_btn.addEventListener(MouseEvent.CLICK, masterScenarioClicked);
task1_btn.addEventListener(MouseEvent.CLICK, task1_btnClicked);
task2_btn.addEventListener(MouseEvent.CLICK, task2_btnClicked);
task3_btn.addEventListener(MouseEvent.CLICK, task3_btnClicked);
task4_btn.addEventListener(MouseEvent.CLICK, task4_btnClicked);
task5_btn.addEventListener(MouseEvent.CLICK, task5_btnClicked);
task6_btn.addEventListener(MouseEvent.CLICK, task6_btnClicked);
task7_btn.addEventListener(MouseEvent.CLICK, task7_btnClicked);
task8_btn.addEventListener(MouseEvent.CLICK, task8_btnClicked);
task9_btn.addEventListener(MouseEvent.CLICK, task9_btnClicked);
task10_btn.addEventListener(MouseEvent.CLICK, task10_btnClicked);

function removeSWF(e:Event){
swfLoader.unloadAndStop();
}

addChild(swfLoader);

function introductionClicked(event:Event):void{
trace(“The Introduction to GCCS-J button was clicked”);
swfLoader.load(new URLRequest(“sample1.swf”));
addChild(swfLoader);
swfLoader.x=0;
swfLoader.y=0;

}
function portalFeaturesClicked(event:Event):void{
trace(“The Portal Features button was clicked”);
swfLoader.load(new URLRequest(“Section_1A.swf”));
addChild(swfLoader);
swfLoader.x=0;
swfLoader.y=-50;

}
function basicsClicked(event:Event):void{
trace(“The Basics of GCSS-J was clicked”);
swfLoader.load(new URLRequest(“Sample3.swf”));
addChild(swfLoader);
swfLoader.x=0;
swfLoader.y=0;
}

This is the code that closes the swfs not created in captivate looks like this.

stage.addEventListener(Event.ENTER_FRAME, removeThis);
function removeThis(e:Event){
MovieClip(this.parent.parent).removeSWF(e);
}