Testing when a loaded swf is finished playing (check code please)

Hello,
Working on loading in 27 external swf files in 9 containers on a main stage. I want to automate this so I don’t have to put code in each clip and instead have all the code centralized on the main stage. I want to use an onEnterFrame on the main stage to check if the currentframe is the last and then if so remove the clip and load the next one. So far I am working on just loading and unloading a clip.

Can someone please tell me why this code doesn’t work on the main timeline


box1.onEnterFrame = function(){
	if(box1._currentframe == 1){
		trace("frame 1");
		photoBox1.gotoAndPlay("on");
	}else if(box1._currentframe != 1 && box1._currentframe == box1._totalframes){
		trace("end test");
		box1.stop();
		delete box1.onEnterFrame;
		unloadMovie("_root.box1");	
	}
}

but this code does work when put directly on a movie clip? I can’t figure it out…driving me nuts.


onClipEvent(enterFrame){
	if(this._currentframe == 1){
		play();
	}else if(this._currentframe != 1 && this._currentframe == this._totalframes){
		this.stop();
		unloadMovie("_root.box1");
		delete this.onEnterFrame;
	}
}

A side question:
I am also using embedded video since this is Flash MX and we need to use it for certain purposes. However from the main timeline I seem to be unable to control the video when it is brought in by loadmovie. I can control the video fine when it is embedded directly into the main flash .swf. Any reason why play() and stop() don’t work on the video when it is brought in externally in an swf?