Hey all,
I’ve implemented the dynamic slideshow example found here on kirupa.com - you know, your basic ‘have xml doc tell flash what jpegs to load into an empty movieclip’ type of deal.
However, I’ve modified it such that when these images are loaded in, they’re centered to the Stage - and also, I’ve implemented some code that will check to see if the image is larger than .7 of the stage (the intended viewing area), and resizes it if it is.
It works just fine when it iterates through the first time, but when it loops back to the first image, things start getting rescaled according to the size of whatever the largest image was, with the effect that the images effectively ‘shrink’ when it loops.
Can anybody help me figure out how to make my dynamic slideshow have centered, auto-resized images? I don’t want to be forced to make all images the same size, or specify their dimensions in the XML doc…
Code for resize/center (placed on the empty movie clip that contains the loaded images):
onClipEvent(enterFrame)
{
checkPictureSize();
centerPicture();
}
onClipEvent(load){
function checkPictureSize()
{
scalar = (this._height / this._width);
if (this._width > (Stage.width * .7))
{
this._width = (Stage.width * .7);
this._height = (this._width * scalar);
}
}
function centerPicture()
{
wDiff = (Stage.width - this._width);
hDiff = (Stage.height - this._height);
this._x = wDiff/2;
this._y = hDiff/2;
}
}