# Preloading jpegs

**URL:** <https://forum.kirupa.com/t/preloading-jpegs/45347>\
**Category:** Uncategorized\
**Created:** [March 13, 2004, 3:05pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347 "2004-03-13T15:05:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brockus](https://avatars.discourse-cdn.com/v4/letter/b/6bbea6/32.png) [@brockus](https://forum.kirupa.com/u/brockus)\
**Post date:** [March 13, 2004, 3:05pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347/1 "2004-03-13T15:05:30Z")

</div>

I’m always conscious of the dial up user and because of this I use preloaders quite frequently. The only way that I have been able to manage preloading pictures is to make a swf with each image and a preloader within that swf. The main movie then calls in the swf. Because the amount of jpegs keeps getting larger and larger I would like to be able to just throw a bunch of jpegs in a folder and have a preloader within the main movie detect the amount of data being loaded. Is this even possible? Thanks in advance…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 4:00pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347/2 "2004-03-13T16:00:05Z")

</div>

yes, flash has the wonderful functions, getBytesTotal() and getBytesLoaded(). use these functions on your movieclips and you should see how a preloader is made 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 4:18pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347/3 "2004-03-13T16:18:14Z")

</div>

I currently use these functions on the preloaders of each swf that loads in. I fail to realize the code that I code use with my load movie command in my main movie. Do you have example code I could see?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 4:32pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347/4 "2004-03-13T16:32:14Z")

</div>

You can use these functions on a movieclip containing the jpeg as well. Just think of them as separate swfs 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 13, 2004, 4:58pm UTC](https://forum.kirupa.com/t/preloading-jpegs/45347/5 "2004-03-13T16:58:57Z")

</div>

stop();  
myInterval = setInterval(preloader,10);  
function preloader() {  
if (getBytesLoaded() \>= getBytesTotal()) {  
play();  
clearInterval(myInterval);  
}  
loadBar.\_xscale = getBytesLoaded() / getBytesTotal() \* 100;  
}  
but1.onRelease = function() {  
loadMovie(“picts/1.jpg”, emptyClip);  
};  
but2.onRelease = function() {  
loadMovie(“picts/2.jpg”, emptyClip);  
};  
but3.onRelease = function() {  
loadMovie(“picts/3.jpg”, emptyClip);  
};  
but4.onRelease = function() {  
loadMovie(“picts/4.jpg”, emptyClip);  
};  
but5.onRelease = function() {  
loadMovie(“picts/5.jpg”, emptyClip);  
};  
but6.onRelease = function() {  
loadMovie(“picts/6.jpg”, emptyClip);  
};  
but7.onRelease = function() {  
loadMovie(“picts/7.jpg”, emptyClip);  
};  
but8.onRelease = function() {  
loadMovie(“picts/8.jpg”, emptyClip);  
};

Here is the code that I’m trying to use on the first frame of the main movie. How do I target the jpegs that are loading and then have the load bar move accordingly?
