[Javascript] Image Preloader
suresh kumar
asureshkumar_1983 at yahoo.co.in
Mon Jun 19 00:19:50 CDT 2006
function ImagePreloader(images, call-back)
{
// store the call-back
this.call-back = call-back;
// initialize internal state.
this.nLoaded = 0;
this.nProcessed = 0;
this.aImages = new Array;
// record the number of images.
this.nImages = images.length;
// for each image, call preload()
for ( var i = 0; i < images.length; i++ )
this.preload(images[i]);
}
The call-back function is stored for later use, then each image URL is passed into the preload() method.
ImagePreloader.prototype.preload = function(image)
{
// create new Image object and add to array
var oImage = new Image;
this.aImages.push(oImage);
// set up event handlers for the Image object
oImage.onload = ImagePreloader.prototype.onload;
oImage.onerror = ImagePreloader.prototype.onerror;
oImage.onabort = ImagePreloader.prototype.onabort;
// assign pointer back to this.
oImage.oImagePreloader = this;
oImage.bLoaded = false;
// assign the .src property of the Image object
oImage.src = image;
}
This code i downloaded from net for loading images in my project.I am displaying images in infinite loop untill i close the browser.But i want Particular images is to run for some specific no of times.How can i achieve this task.If any one having the code send me
A.suresh
---------------------------------
Yahoo! India Answers: Share what you know. Learn something new Click here
Send free SMS to your Friends on Mobile from your Yahoo! Messenger Download now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20060619/0e0ae109/attachment.htm>
More information about the Javascript
mailing list