and the thread keeps going… for the life of me I can’t stop the image from flickering… it seems that on the first frame of the resize me function… everything evaluates to true… and makes my image 100% visible… then on consecutive passes, the it’s false, resizes the border and displays my image… the flicker is acceptable on relatively the same size image, but on different ratios the flicker is REALLY apparent… any ideas? here’s my code:
MovieClip.prototype.loadPic = function(pic) {
cur = pic;
this._alpha = 0;
this.loadMovie("images/db/body/"+imgLoc[pic]);
this._parent.onEnterFrame = function() {
var t = containerMC.getBytesTotal(), l = containerMC.getBytesLoaded();
if (t != 0 && Math.round(l/t) == 1 && containerMC._width>0 && containerMC._height>0) {
var w = containerMC._width+spacing, h = containerMC._height+spacing;
//everything below is to control the maximum image size
imgWidth = containerMC._width;
imgHeight = containerMC._height;
if (imgWidth<imgHeight) {
imgRatio = imgWidth/imgHeight;
containerMC._width = imageSize*imgRatio;
containerMC._height = imageSize;
} else if (imgWidth>imgHeight) {
imgRatio = imgHeight/imgWidth;
containerMC._width = imageSize;
containerMC._height = imageSize*imgRatio;
} else if (imgWidth == imgHeight) {
containerMC._width = imageSize;
containerMC._height = imageSize;
}
border.resizeMe(w, h, pic);
delete this._parent.onEnterFrame;
}
};
};
MovieClip.prototype.resizeMe = function(w, h, pic) {
var speed = 3;
this.onEnterFrame = function() {
containerMC._alpha = 0; // had to put this in to stop it from displaying straight off
this._width += (w-this._width)/speed;
this._height += (h-this._height)/speed;
//nav._x = Math.round(this._x-this._width/2); Don't use a nav bar
//nav._y = Math.round(this._y+this._height/2+spacing/2);
prevb._x = this._x-this._width/2-5;
nextb._x = this._x+this._width/2+5;
nextb._y = prevb._y=this._y-5;
imageText._y = this._y+this._height/2+5;
imageText._x = border._x-picinfo._width/2;
photo._y = this._y-this._height/2;
photo._x = this._x-this._width/2+5;
photo.photoID.text = imgPG[pic];//little drop shadow effect
photo.photoID1.text = imgPG[pic];//little drop shadow effect
imageText.text = imgCap[pic];
if (Math.abs(this._width-w)<1 && Math.abs(this._height-h)<1) {
this._width = w;
this._height = h;
containerMC._x = this._x-this._width/2+spacing/2;
containerMC._y = this._y-this._height/2+spacing/2;
containerMC._alpha = 100;
delete this.onEnterFrame;
}
};
};
EDIT: Anyone interested in my solution… I just got rid of the _parent in the first delete onEnterFrame. Don’t remove the first _parent, which creates the onEnterFrame, just in the “delete” don’t ask me why this works, but now everything is a-ok
original:
}
border.resizeMe(w, h, pic);
delete this._parent.onEnterFrame;
}
Fixed:
}
border.resizeMe(w, h, pic);
delete this.onEnterFrame;
}