# Creating a Preloader for loading a JPEG

**URL:** <https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153>\
**Category:** flash\
**Created:** [September 4, 2003, 1:32pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153 "2003-09-04T13:32:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Baggio](https://avatars.discourse-cdn.com/v4/letter/b/dbc845/32.png) [@Baggio](https://forum.kirupa.com/u/Baggio)\
**Post date:** [September 4, 2003, 1:32pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/1 "2003-09-04T13:32:07Z")

</div>

Hey, I need to create a preloader (basic one) for loading a JPEG file so that once the file is loaded I can manipulate it’s properties…

At the moment I have the Images loading into MC which is contained in another movie clip MCholder say.

How do I go about creating a preloader since the gettotalbytes is only available after it’s loaded it always returns 0 :-/

?

Thanks

---

<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:** [September 4, 2003, 3:06pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/2 "2003-09-04T15:06:08Z")

</div>

On the main timeline:

[AS]  
Mcholder.MC.loadMovie(“image.jpg”);  
Mcholder.MC.\_visible = false;  
Mcholder.MC.onEnterFrame = function(){  
l = this.getBytesLoaded();  
t = this.getBytesTotal();  
if(l==t){  
delete this.onEnterFrame  
this.\_visible = true;  
//manipulate here.  
}  
}  
[/AS]

---

<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:** [September 4, 2003, 3:08pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/3 "2003-09-04T15:08:34Z")

</div>

Hmm would that work with a jpeg though?

---

<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:** [September 4, 2003, 3:29pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/4 "2003-09-04T15:29:11Z")

</div>

Lol, sorry, that should’ve been .jpg 😛 _edits post_

---

<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:** [September 4, 2003, 3:31pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/5 "2003-09-04T15:31:11Z")

</div>

Ahh ok i’ll 😃

I’ll try it thanks

---

<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:** [September 4, 2003, 7:24pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/6 "2003-09-04T19:24:12Z")

</div>

Hmm as i suspected it didn’t work ☹ there HAS to be a way surely?!

---

<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:** [September 4, 2003, 7:27pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/7 "2003-09-04T19:27:49Z")

</div>

That pretty much HAS to work :-\ Are you sure the image isn’t progressive ? Are you sure the filename is correct ? Are you sure it’s in the same directory as the swf file ? Are you sure the path is correct ? Are you sure you placed it on the main timeline ? Are you sure you gave the correct instance names ? …

If the answer to all is yes, post your fla and image or send it to me so I can have a look at it.

---

<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:** [September 4, 2003, 7:37pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/8 "2003-09-04T19:37:50Z")

</div>

It isn’t progressive as i tried just now to simply load it in a test flas and it loads fine, thr file name will be correct as it DOES load you see it’s an image gallery and the url of all the images are found in a mySQL database which i connect to through perl… I’m not sure whether I can place it on the main timeline the whole thing is 500kb so you can download it from

[www.dream-odyssey.com/dreamviewer.zip](http://www.dream-odyssey.com/dreamviewer.zip)

Basically if you drill down to the reelMCImages movieclip you’ll find a clip called MCThumb1 an instance of ReelMCImage check out the action for that , that is where i placed your code snippet

the actual container it loads in can be found at \_root.ImgLayer.imgcont

The images are all on the web server so they’ll just download

Thanks

---

<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:** [September 4, 2003, 10:09pm UTC](https://forum.kirupa.com/t/creating-a-preloader-for-loading-a-jpeg/30153/9 "2003-09-04T22:09:08Z")

</div>

anyone?
