Below is part of my flash movie and it works syntax wise but I don’t get the results I want. For example under the thumbnails function after the first image it creates it sizes the image exactly like I want it. But the second image it will not resize at all, why?
The resize prototype is called twice but won’t resize on the second loop value. Weird…What I’m I doing wrong?
_global.LoadThumbNails= function()
{
var iNumPics; //contains the number of Pictures to create
for (i=0; i <= 1; i++)
{
ThumbNailMc= _root.McHolder[“ColorMc” + McColors*];
ContainerMc= ThumbNailMc.createEmptyMovieClip(“PicContainer”,i);
ContainerMc.loadMovie(“pict0002.jpg”);
var bytes_loaded= Math.round(ContainerMc.getBytesLoaded());
var bytes_total= Math.round(ContainerMc.getBytesTotal());
var getPercent= bytes_loaded/bytes_total;
ThumbNailMc.onEnterFrame= function()
{
if (bytes_loaded >1 && bytes_loaded > bytes_total-10 && ContainerMc._width > 0 && getPercent >= 1)
{
ContainerMc.ResizeImage(45,20);
ContainerMc._x= (-1 * (ContainerMc._width/2)) ;
ContainerMc._y= -1 * (ContainerMc._height/2);
ContainerMc._alpha= 100;
delete this.onEnterFrame;
}
else
{
bytes_loaded= Math.round(ContainerMc.getBytesLoaded());
bytes_total= Math.round(ContainerMc.getBytesTotal());
getPercent= bytes_loaded/bytes_total;
}
}//thumbnail...
} //for
} //function
MovieClip.prototype.ResizeImage= function(wMax, hMax)
{
if(this._width > wMax || this._height > hMax)
{
//which dimension is the most oversized
wDiff = this._width - wMax;
hDiff = this._height - hMax;
//calculate ratio
if(wDiff > hDiff)
{
ratio = (wMax/this._width) * 100;
}
else
{
ratio = (hMax/this._height) * 100;
}
}
else
{
//if image doesn’t need to be resized set ratio to 100
ratio = 100;
}
this._xscale = this._yscale = ratio;
};