# Dynamically loading growing image slideshow

**URL:** <https://forum.kirupa.com/t/dynamically-loading-growing-image-slideshow/234289>\
**Category:** flash\
**Created:** [August 1, 2007, 3:44am UTC](https://forum.kirupa.com/t/dynamically-loading-growing-image-slideshow/234289 "2007-08-01T03:44:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashnub](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@flashnub](https://forum.kirupa.com/u/flashnub)\
**Post date:** [August 1, 2007, 3:44am UTC](https://forum.kirupa.com/t/dynamically-loading-growing-image-slideshow/234289/1 "2007-08-01T03:44:21Z")

</div>

Hi all.

I am relatively new to flash and kirupa and i was wondering if i could get some advice from the community. I have made a website the requires images to load in dynamically and to expand or grow, then fade into the next image.

Now i have this working but it makes the site VERY jerky. i have not figured out how to incorporate loading SMOOTHED images into the site so i have made the images swf files and imported them. Any feedback on how to make it so the site is not jerky will be much appreciated.

I also use tweener (new mctween)

here is the code.

//----------------------------------------------------------

//— VARIABLES FOR IMAGE LOAD AND SWAP —  
pageCount = 1;  
loadingImage = 2;  
loadedImageCount = 1;  
minImages = 1;  
maxImages = 23;

//— LOADS ALL THE IMAGES IN ON AT A TIME —  
function loadImages() {  
if (\_root.loadedImageCount\<\_root.maxImages) {  
imagesHolder = \_root.mainImageTween.mainImageHolder.createEmptyMovieClip(“image”+loadingImage, loadingImage);  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+loadingImage],{ \_scale:85, \_alpha:0, \_x:-900});

```
    imgLoader = new MovieClipLoader();
    listener = new Object();
    listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
        //trace(target+".onLoadProgress with "+bytesLoaded+" bytes of "+bytesTotal);
    };
    imgLoader.addListener(listener);
    imgLoader.loadClip("images/image"+loadingImage+".swf",_root.imagesHolder);

    interval = new Object();
    interval.id = setInterval(checkProgress, 100, imgLoader, imagesHolder, interval);
}

```

}  
//— CHECKS IF IMAGE HAS FINISHED LOADING BEFORE LOADING THE NEXT IMAGE —  
function checkProgress(imgLoader, imagesHolder, interval:Object):Void {  
//trace("\>\> checking progress now with : "+interval.id);  
var progress:Object = imgLoader.getProgress(imagesHolder);  
//trace("bytesLoaded: “+progress.bytesLoaded+” bytesTotal: "+progress.bytesTotal);  
if (progress.bytesLoaded == progress.bytesTotal) {  
clearInterval(interval.id);  
\_root.loadedImageCount++;  
\_root.loadingImage++;  
\_root.loadImages();  
}  
}  
//— LOADS ALL THE IMAGES IN ON AT A TIME —

var intervalId:Number;

//— CONTROLS THE IMAGES SWAPPING —

function executeCallback():Void {  
if (pageCount == loadedImageCount) {  
pageCount = 1;  
Tweener.addTween(\_root.mainImageTween.mainImageHolder.image1,{\_x:0, time:0, transition:“linear”});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder.image1,{\_alpha:100, time:2, transition:“linear”});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder.image1,{\_scale:90, time:8, transition:“linear”});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+loadedImageCount],{\_alpha:0, time:2});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+loadedImageCount],{\_scale:85, \_x:-900, time:0, delay:2});  
//clearInterval(intervalId);  
} else {  
pageCount++;  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+\_root.pageCount],{\_x:0, time:0});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+\_root.pageCount],{\_alpha:100, time:2, transition:“linear”});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+\_root.pageCount],{\_scale:90, time:8, transition:“linear”});  
Tweener.addTween(\_root.mainImageTween.mainImageHolder[“image”+(\_root.pageCount-1)],{\_scale:85, \_alpha:0, \_x:-900, time:0, delay:2});  
}  
}

//— SETS INTERVAL TO SWAP IMAGES EVERY 7 SECONDS —  
intervalId = setInterval(this, “executeCallback”, 7000);

loadImages();

//------------------------------------------------------
