Need Help, slideshow image resize?

Attached are my FLA, xml, and jpeg.

I thought this code should work to resize the size of the movieclip thus the picture would appear that size, alas it doesn’t. When it loads a picture bigger than 220x220 the sizing goes nuts and extends one way forever and one way realy small.

Focusing on

if (hor > 220) {
targetClip._width = hor;
}
if (vert > 220) {
targetClip._height = vert;
}
while (targetClip._width > 220) {
targetClip._width = targetClip._width - 10;
targetClip._height = targetClip._height - 10;
}
while (targetClip._height > 220) {
targetClip._width = targetClip._width - 10;
targetClip._height = targetClip._height - 10;
}

Any reason why this doesn’t work or a solution to my problem would be REALLY appreciated. I appologize if this has been solved elsewhere, I couldn’t find it.