Dynamically loaded jpgs won't unload in new frames

Hello,
This is my first posting and I’m fairly new at Flash. I’ve searched elsewhere for an answer to this question, but nothing’s helped. Perhaps someone will have an answer here?

I am creating dynamically loaded thumbnails in Frame 10. These load perfectly. But when I click on a button to go to a Frame 5 the thumbnails still appear. I’ve tried unloadMovie but it doesn’t work. What am I doing wrong?

Below is the ActionScript for the thumbnails.

mydata=new XML;
mydata.ignoreWhite=true;
mydata.load(“datahome.xml”);
mydata.onLoad=dosomething;

function dosomething(success) {
if (success) {

	showinfo(0);
	
	originalx=180;
	originaly=90;
	currentx=originalx;
	currenty=originaly;
	
// Create thumbnails

	for (i=0; i<5; i++) {
	_root.attachMovie("thumbnailmovie", "thumbnail1" +i , 10000+i);
	_root["thumbnail1" +i].thumbnailname=mydata.firstChild.childNodes[0].childNodes[5].childNodes*.firstChild.nodeValue;
	_root["thumbnail1" +i].itemnumber=i;
	_root["thumbnail1" +i]._x=currentx;
	_root["thumbnail1" +i]._y=currenty;
	currenty+=75;
	}
}

}