Preloading loadMovie(JPEG-file)

I’m loading a JPEG file with the loadMovie() method, is there any way to preload this, or to view the loading progress?

[SIZE=1](note: I quickly browsed through some of the preloading topics here, but none answered this issue.)[/SIZE]

untested, but you might try this:

on the button:


on(release){
  _root.container.loadMovie("myPicture.jpg");
  t = _root.container.getBytesTotal();
  l = _root.container.getBytesLoaded();
  percent = (l/t)*100;
  if (t>0 && percent<100) _root.container.percentage = percent;
}

and put an mc with an instance name of container on your main timeline. In this container mc, create a dynamic textfield with a variable name of percentage

Cheers.

Ik hoop dat het werkt… :wink:

that won’t work. it will load the picture, but you need a loop to check for the bytesLoaded and bytesTotal

  • feeling very stupid now *

I was wondering myself how I would be able to test a preloader like this. 'cause in Flash when I do ‘Show Streaming’ it won’t show the preloader for a loadMovie, would it?

Anyway, how about this?

On the main timeline:


this.onEnterFrame = function(){
  t = _root.container.getBytesTotal();
  l = _root.container.getBytesLoaded();
  percent = (l/t)*100;
  if (t>0 && percent<100) _root.container.percentage = percent;
}

and on the load-button:


on(release){
  _root.container.loadMovie("1.jpg");
}