# Help w/adding a preloader

**URL:** <https://forum.kirupa.com/t/help-w-adding-a-preloader/240712>\
**Category:** flash\
**Created:** [October 5, 2007, 8:34am UTC](https://forum.kirupa.com/t/help-w-adding-a-preloader/240712 "2007-10-05T08:34:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![joepreston](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@joepreston](https://forum.kirupa.com/u/joepreston)\
**Post date:** [October 5, 2007, 8:34am UTC](https://forum.kirupa.com/t/help-w-adding-a-preloader/240712/1 "2007-10-05T08:34:49Z")

</div>

am currently using this script to run through an array:

> swfArray = new Array(“images/indep/1.jpg”, “images/indep/2.jpg”, “images/indep/3.jpg”, “images/indep/4.jpg”, “images/indep/5.jpg”, “images/indep/6.jpg”, “images/indep/7.jpg”, “images/indep/8.jpg”, “images/indep/9.jpg”, “images/indep/10.jpg”, “images/indep/11.jpg”, “images/indep/12.jpg”, “images/indep/13.jpg”);  
> this.createEmptyMovieClip(“target1”,2);  
> this.createEmptyMovieClip(“target2”,1);  
> target1.loadMovie(swfArray[0]);  
> activeTarget = target1;  
> preview = null;  
> count = 0;  
> \_level5.nextButton.onRelease = function() {  
> if (count\<swfArray.length-1) {  
> count++;  
> } else {  
> count = 0;  
> }  
> preview = activeTarget;  
> activeTarget = (preview!=target1) ? target1:target2;  
> activeTarget.loadMovie(swfArray[count]);  
> activeTarget.swapDepths(preview)  
> alfa();  
> };  
> \_level5.prevButton.onRelease = function() {  
> if (count\>0) {  
> count–;  
> } else {  
> count = swfArray.length-1  
> }  
> preview = activeTarget;  
> activeTarget = (preview!=target1) ? target1:target2;  
> activeTarget.loadMovie(swfArray[count]);  
> activeTarget.swapDepths(preview)  
> alfa();  
> };  
> function alfa() {  
> import mx.transitions.Tween;  
> import mx.transitions.easing.\*;  
> time=1  
> t1.stop();  
> t2.stop();  
> delete t1;  
> delete t2;  
> t1 = new Tween(activeTarget, “\_alpha”, easeIn, activeTarget.\_alpha, 100, time, true);  
> t2 = new Tween(preview, “\_alpha”, Strong.easeOut, preview.\_alpha, 100, time, true);  
> }

Previously i was pulling in swf files with this running the preloader:

> ```
> loaderInterval = setInterval (preloader, 10);
> 
> ```

function preloader() {  
if (\_framesloaded\>=\_totalframes) {  
gotoAndStop(2);  
clearInterval(myInterval);  
}  
progressBar.\_xscale = (framesloaded/\_totalframes)\*100;  
}  
is there a way i can add my current preloader to the array script so i pull in jpgs instead of swf files?
