# Jpeg load progress

**URL:** <https://forum.kirupa.com/t/jpeg-load-progress/29790>\
**Category:** Uncategorized\
**Created:** [August 30, 2003, 9:47pm UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790 "2003-08-30T21:47:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimw00d](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jimw00d](https://forum.kirupa.com/u/jimw00d)\
**Post date:** [August 30, 2003, 9:47pm UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/1 "2003-08-30T21:47:32Z")

</div>

Is it possible in flash mx to report the download progress of a jpeg in the same way that the progress of a downloading swf can be reported.

If so would it be correct to address the jpeg or the container into which the jpeg will be loaded and contained?

---

<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:** [August 30, 2003, 9:53pm UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/2 "2003-08-30T21:53:54Z")

</div>

Yes, it’s exactly the same process. And you target the MovieClip into which the JPEG will be loaded. 😉

---

<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:** [August 31, 2003, 1:56pm UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/3 "2003-08-31T13:56:31Z")

</div>

you can’t tell flash to show the percentage of loaded jpg - it can only work with swf. But you can tell that the image is loaded by checking the width of the container (which increases when the jpg ‘pops’ in)

---

<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:** [August 31, 2003, 5:01pm UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/4 "2003-08-31T17:01:16Z")

</div>

…What the hell are you talking about, mlk!? You can show the percentage loaded of the JPEG. 😛

Just place the dynamic TextField on the parent of the MovieClip into which the image will be loaded, and the code should be something along these lines:  
[AS]this.createEmptyMovieClip(“preloader”, 9876);  
preloader.onEnterFrame = function() {  
var bloaded = myMovieClip.getBytesLoaded();  
var btotal = myMovieClip.getBytesTotal();  
var percentage = Math.floor(100\*bloaded/btotal);  
// is that ^ the percentage loaded? I think it is :\*\*\*\*P  
myTextField.text = percentage;  
if (bloaded\>0 && bloaded == btotal) {  
trace(“The image has been loaded”);  
// some actions here  
this.removeMovieClip();  
}  
};[/AS]  
The code would be placed in the parent MovieClip, where _myTextField_ is the instance name of the TextField in which the percentage will be shown and _myMovieClip_ is the MovieClip into which the image will be loaded. :sigh:

---

<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 2, 2003, 2:12am UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/5 "2003-09-02T02:12:59Z")

</div>

OK so the code I am using is:

// create container for pictures  
\_root.createEmptyMovieClip(“container”, 1);  
// positions the container  
container.\_x = 22;  
container.\_y = 235;  
// load movie on button press  
but1.onPress = function() {  
loadMovie(“pic1.jpg”, “container”);  
// load text  
loadText = new loadVars();  
loadText.load(“pic1.txt”);  
intro.text = " ";  
// tells movie to execute the function when the data has been transferred  
loadText.onLoad = function() {  
details.text = this.details;  
};  
};

The results are at:

[http://aratika.nbkayaking.com](http://aratika.nbkayaking.com)

Anyway.

I have eight buttons with the code above attached to each button.

I still don’t seem to be able to reference the jpeg i.e. “pic1.jpg”

Where should I place the preloader code, definately after the button assignment.

Would:

\_root[“pic1.jpg”].getBytesLoaded

work because I can’t get it to. I thought this was the correct way to reference a jpeg, I can’t use \_root.pic1.jpg

Cheers

---

<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 2, 2003, 5:05am UTC](https://forum.kirupa.com/t/jpeg-load-progress/29790/6 "2003-09-02T05:05:20Z")

</div>

> _Originally posted by kode_  
> **And you target the MovieClip into which the JPEG will be loaded. 😉**

[AS]container.getBytesLoaded();  
container.getBytesTotal();[/AS]
