Jpeg load progress

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?

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

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)

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

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:

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

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

Originally posted by kode
And you target the MovieClip into which the JPEG will be loaded. :wink:

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