Dynamic onPress()

I am looking to make a lot of buttons dynamic. I have been trying something like this:


for (i=0; _root.numPhotos>i; i++) {
	pMovie_clip = eval("b")+i;
	pMovie_clip.onPress = function() {
	_root.loadMovie("http://www.d.com/"+i+"jpg")	
	};
}

This does not work; I do not think the onPress function is being created. Any thoughts on how this might be done?