all groups > flash (macromedia) > july 2003 >
You're in the

flash (macromedia)

group:

How can I know if a group of jpg have been loaded dynamically / preloader?



How can I know if a group of jpg have been loaded dynamically / preloader? desters
7/19/2003 10:49:30 PM
flash (macromedia): Before going and play another frame I want to use a preloader for a group of images.

I guess that gettotalbytes does not reflect bytes in a a series of jpgs loaded dynamically.

How can I use preloader to show the images/bytes being loaded?

Re: How can I know if a group of jpg have been loaded dynamically / preloader? sly one
7/20/2003 1:22:42 AM
I have used this with success to preload jpegs:




//this function requires an image container like so: container.imageHolder_mc.image_mc
//and a preload animation on the main timeline: here its called "flasher"
image = _root.container.imageHolder_mc.image_mc;
//make a short var to use as ref for loading images
_root.container.imageHolder_mc._visible = false;
//make the image container invisible

// call this function when you want to start loading:
function loadthefirst() {
loadCheckID = setInterval(preloadImage, 100, getTimer());
//set an interval for preloading- 100 milliseconds here
function preloadImage(startLoadTime) {
_root.flasher.gotoAndPlay(2);
//start the preload anim playing
if ((_root.image.getBytesTotal()>4) && _root.image.getBytesLoaded() == _root.image.getBytesTotal()) {
//is the load finished?
clearInterval(loadCheckID);
//if so, stop preloading (clear the interval)
_root.container.imageHolder_mc._visible = true;
//make the container visible
_root.flasher.gotoAndStop(1);
//stop the preload anim
} else if ((_root.image.getBytesTotal()>4) && (getTimer()-startLoadTime>7000)) {
//error check
_root.flasher.gotoAndStop(1);
trace("load error");
}
}
}


AddThis Social Bookmark Button