# Preloading external jpegs

**URL:** https://forum.kirupa.com/t/preloading-external-jpegs/204835
**Category:** Uncategorized
**Created:** [October 23, 2006, 10:43pm UTC](https://forum.kirupa.com/t/preloading-external-jpegs/204835 "2006-10-23T22:43:48Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Mak\_Valley](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Mak\_Valley](https://forum.kirupa.com/u/Mak_Valley)
#### Post date: [October 23, 2006, 10:43pm UTC](https://forum.kirupa.com/t/preloading-external-jpegs/204835/1 "2006-10-23T22:43:48Z")

</div>

i’m currently making a slideshow for work, and they want all the pictures to preload before the show starts… here’s my code

```auto

var mymcl = new MovieClipLoader;
var mymclistener:Object = new Object;

mymclistener.onLoadStart = function (target){
	var loadProgress = mymcl.getProgress(target);
	trace("the clip "+target+" has started loading");
	trace("Bytes loaded: "+loadProgress.bytesLoaded);
	trace("Total bytes: "+loadProgress.bytesTotal);
}

 
 
 mymclistener.onLoadProgress = function(target, totalbytes, loadedbytes){
	 trace ("Bytes loaded: "+loadedbytes);
	 trace("bytes total: "+totalbytes);
 }
 
 mymclistener.onLoadComplete = function(target){
	 var loadProgress = mymcl.getProgress(target);
	 mytrace(target+"has finished loading");
	 trace ("Bytes loaded: "+loadProgress.bytesLoaded+" Bytes total: "+loadProgress.bytesLoaded);
 }
 
 
mymclistener.onLoadInit = function(target){
	trace ("MC:"+target+" is good to go");
	target._x = 0
	target._y = 0;
}

mymcl.addListener(mymclistener);
mymcl.loadClip("http://www.jahdesign.com/pictures/1.jpg", holder);

```

works nicely… however, i can’t get it to load all the pictures! i tried something like this

```auto

for (i=1; i<4; i++){
mymcl.loadClip("http://www.jahdesign.com/pictures"+1+".jpg", holder);
}

```

all this does is jump to the last picture and load that one… so it had me thinking, and i did this to see what would happen:

```auto

btn1.onPress = function(){
mymcl.loadClip("http://www.jahdesign.com/pictures/1.jpg", holder);
}
// i made three buttons like this one

```

and what happens to that is, the pictures get preloaded each time the button is pressed. (meaning instead of preloading the first time and showing up immediately thereafter, it’s preloaded every time!)

i’m lost and i really don’t know where i’m going with this… could somebody please explain to me what i’m doing wrong and what i need to do? if my problem is clear enough, i want to preload multiple jpegs then display them one after another (like in a slideshow) in a movie clip (“holder” as in the code above)… please? thank you!

---

<div class="post-metadata">

### Author: ![Mak\_Valley](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Mak\_Valley](https://forum.kirupa.com/u/Mak_Valley)
#### Post date: [October 23, 2006, 11:37pm UTC](https://forum.kirupa.com/t/preloading-external-jpegs/204835/2 "2006-10-23T23:37:21Z")

</div>

about the preloading everytime the button is pressed thing: it actually works, i had been testing it in flash and never thought to publish it and run it in it’s actual environment. i still have it other problems though if anybody could help.

---

<div class="post-metadata">

### Author: ![Mak\_Valley](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Mak\_Valley](https://forum.kirupa.com/u/Mak_Valley)
#### Post date: [October 24, 2006, 1:45am UTC](https://forum.kirupa.com/t/preloading-external-jpegs/204835/3 "2006-10-24T01:45:16Z")

</div>

yet another question.

```auto

mymcl.loadClip("http://www.jahdesign.com/pictures/1.jpg", holder);

//could i use the line below to re-call the same picture if another is currently in the holder clip and would it be preloaded??

holder.loadMovie("http://www.jahdesign.com/pictures/1.jpg");

```

---

<div class="post-metadata">

### Author: ![Mak\_Valley](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Mak\_Valley](https://forum.kirupa.com/u/Mak_Valley)
#### Post date: [October 24, 2006, 9:59pm UTC](https://forum.kirupa.com/t/preloading-external-jpegs/204835/4 "2006-10-24T21:59:36Z")

</div>

anybody?
