View Full Version : Preloading loadMovie(JPEG-file)
oscar alexander
April 10th, 2003, 09:18 AM
I'm loading a JPEG file with the loadMovie() method, is there any way to preload this, or to view the loading progress?
(note: I quickly browsed through some of the preloading topics here, but none answered this issue.)
Flashmatazz
April 10th, 2003, 11:29 AM
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... ;)
Jubba
April 10th, 2003, 11:38 AM
that won't work. it will load the picture, but you need a loop to check for the bytesLoaded and bytesTotal
Flashmatazz
April 10th, 2003, 01:42 PM
* 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");
}
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.