# FLASH 8 - Preloader for Dynamically loading images

**URL:** https://forum.kirupa.com/t/flash-8-preloader-for-dynamically-loading-images/223566
**Category:** flash
**Created:** [April 23, 2007, 11:35pm UTC](https://forum.kirupa.com/t/flash-8-preloader-for-dynamically-loading-images/223566 "2007-04-23T23:35:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mpot](https://avatars.discourse-cdn.com/v4/letter/m/bb73d2/32.png) [@mpot](https://forum.kirupa.com/u/mpot)
#### Post date: [April 23, 2007, 11:35pm UTC](https://forum.kirupa.com/t/flash-8-preloader-for-dynamically-loading-images/223566/1 "2007-04-23T23:35:23Z")

</div>

So I have a current flash file that has external swf’s loading into a “container” clip. Inside those swf’s are dynamically loading jpegs. All of this is working really smoothly except for the problem that the jpegs are a little bit too big(kb) and take a while to load. So you press a button and wait for a while then the image pops up. So what I want to do is use the preloader I created for my swfs --the link the preloader I am using is here—\>\>[http://www.actionscript.org/resource…der/Page1.html](http://www.actionscript.org/resources/articles/165/1/Yet-Another-Flash-MX-Loader/Page1.html)

Is there any way to add the same preloader to my dynamically loading images?? Here is the code I have for my dynamically loading images, \*Thanks to Stringy

myarray = [];  
btnarray = [];  
var count = 0;  
var p = mc1.mc.createEmptyMovieClip(“p”, 1);  
var q = mc2.mc.createEmptyMovieClip(“p”, 1);  
mc = mc1;  
oldmc = mc2;  
//you would get this from xml -easy peasy  
for (var i = 1; i\<7; i++) {  
myarray.push(“[http://www.myserverhere.com/p"+i+".png](http://www.myserverhere.com/p%22+i+%22.png)”);  
this[“btn”+i].ivar = i-1;  
this[“btn”+i].onPress = presto;  
btn1.onPress()  
btnarray.push(this[“btn”+i]);  
}  
function checkload() {  
dis(false)  
onEnterFrame = function () {  
if (mc.mc.p.\_width) {  
mc.swapDepths(oldmc);  
mc.gotoAndPlay(2);  
delete this.onEnterFrame;

```
        oldmc.onEnterFrame = fade
    }
};

```

}  
function fade(){  
if(this.\_alpha\>0){  
this.\_alpha -=25  
}else{  
this.\_alpha = 0  
delete this.onEnterFrame  
var myvar = mc;  
mc = oldmc;  
oldmc = myvar;  
dis(true)  
}  
}  
function f() {  
mc.\_alpha = 100  
mc.mc.p.loadMovie(myarray[count]);  
checkload();  
count++;  
count %= myarray.length;  
}  
function presto() {

```
count = this.ivar;
f();

```

}  
function dis(v){  
for (var i = 0; i\<btnarray.length; i++) {  
btnarray\*.enabled =v  
}  
}

Thanks,  
–M
