# Help with jpg preload code

**URL:** https://forum.kirupa.com/t/help-with-jpg-preload-code/98214
**Category:** Uncategorized
**Created:** [January 4, 2004, 8:13pm UTC](https://forum.kirupa.com/t/help-with-jpg-preload-code/98214 "2004-01-04T20:13:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)
#### Post date: [January 4, 2004, 8:13pm UTC](https://forum.kirupa.com/t/help-with-jpg-preload-code/98214/1 "2004-01-04T20:13:38Z")

</div>

First off I have read many MANY posts on preloading jpgs. I am using code posted by LIB in [this thread](http://www.kirupaforum.com/forums/showthread.php?threadid=15472&perpage=15&pagenumber=2)

I have on my main stage a container clip. It is on this container clip that I want to use the code. I have this in the Actionscript layer of the container clip:  
[AS]  
this.createEmptyMovieClip(“pload”, 1000);  
this.createEmptyMovieClip(“imagecon”, 1001);  
[//imagecon.loadMovie](https://imagecon.loadMovie)(“yourImage.jpg”);  
imagecon.\_x = 24.3;  
imagecon.\_y = 49.5;  
imagecon.\_visible = false;  
pload.onEnterFrame = function() {  
var l = imagecon.getBytesLoaded();  
var t = imagecon.getBytesTotal();  
var getPercent = l/t;  
loadText = Math.round(getPercent_100)+"%";  
loadBar.\_width = getPercent_200;  
if (l\>0 && l\>=t) {  
imagecon.\_visible = 1;  
delete this.onEnterFrame;  
}  
};  
[/AS]

On the MAIN timeline I have a button and I have this code on the button:  
[AS]  
on(release){  
//some other stuff  
\_root.container.imagecon.loadMovie(“pics/mst\_s2.jpg”);  
}  
[/AS]

When I test the movie all is dandy, though because it’s all sitting on my hard drive you don’t really see the preloader, just the pic. However, when I upload it to the server all you see is “0%”. The pic is only 3kb - so what the hey?

Any help appreciated! :bu:

---

<div class="post-metadata">

### Author: ![xyeight](https://avatars.discourse-cdn.com/v4/letter/x/ba9def/32.png) [@xyeight](https://forum.kirupa.com/u/xyeight)
#### Post date: [August 12, 2004, 11:27am UTC](https://forum.kirupa.com/t/help-with-jpg-preload-code/98214/2 "2004-08-12T11:27:21Z")

</div>

hey…can you attach the file…please…i’m a bad actionscripter…i can’t understand some of the part that you talking about…so if you don’t mind, i could learn better with the help of the fla file.  
thanks

---

<div class="post-metadata">

### Author: ![FlashPlaya](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@FlashPlaya](https://forum.kirupa.com/u/FlashPlaya)
#### Post date: [August 12, 2004, 5:26pm UTC](https://forum.kirupa.com/t/help-with-jpg-preload-code/98214/3 "2004-08-12T17:26:29Z")

</div>

Hey lunatic,  
Tried it, and I could not get it? Tried thread \*#14

---

<div class="post-metadata">

### Author: ![lunatic](https://avatars.discourse-cdn.com/v4/letter/l/73ab20/32.png) [@lunatic](https://forum.kirupa.com/u/lunatic)
#### Post date: [August 12, 2004, 6:54pm UTC](https://forum.kirupa.com/t/help-with-jpg-preload-code/98214/4 "2004-08-12T18:54:44Z")

</div>

Hey everyone,

I am currently out of town (away from home and Flash ☹ ) for a couple more days. I’ll try to get to this thread when I return. In the meantime, anyone else who has successfully pulled this off (you know who you are! 😛 ) please feel free to fill in for me!

:hr:
