ANOTHER image resize question!

1st post, hooray! :pleased: First off, thanks to everyone who has posted examples/tutorials on this excellent site, you’ve helped me get a lot of difficult (for me anyway!) stuff done quickly.
So…I’ve followed the tuts on the site and written||cut’n’paste a few bits together that resize my picture to the border’s size.

function resizePic(w,h){
var x_scale = y_scale = scale = 100;
x_scale=border._width/w;
y_scale=border._height/h;
scale = Math.min(x_scale, y_scale)*100;
picture._xscale = picture._yscale = scale;
}

** function loadPic**(pic){
picture.loadMovie(pic, 1);
** this.onEnterFrame** = function() {
f = picture.getBytesTotal();
l= picture.getBytesLoaded();
preloader._visible = true;
if (l!= f) {preloader.preload_bar._xscale = 100*loaded/filesize;}
else {preloader._visible = false;
if (picture._alpha<100){
picture._alpha += 10;
}
}
picture._xscale = picture._yscale = 100;
if(picture._width>border._width||picture._height>border._height){
resizePic(picture._width, picture._height);
}
}
}

First; this code didn’t work properly until I put the ‘this.onEnterFrame’ section just before the resizePic function is called. Why?

Second; I’ve noticed a lot of times ‘onEnterFrame’ is called, its deleted again further down the code. Should I be doing so in this case? Why is it normally deleted? Memory managent?

Thanks for any help!