Yes I'd be all for replacing the current image loader with this one. Either including it as a separate imageloder.js or within dynimage. As a suggestion, for making the possibility of having a cool progressbar to work along with it, allow an option to add the byte-size of the image. This way if you have 20 small images, and one huge image the progressbar would know the relative ratios between images.
The replacement for DynAPI.onLoad will not be a problem, you can just add the function to start the image loader with: DynAPI.document.onLoad(function() {/* your code */}); Dan Steinman On Mon, Nov 12, 2001 at 11:09:14AM +0100, Richard Bennett wrote: > Hi, > As usual you have some very nice code in there. > > A few points: > A few examples would be welcome. > Support for .PNGs would be desirable. > We have a choice, release this as an optional component, in an add-on pack > (with all the animation routines etc), or, replace Dynimage. > If we want to replace dynimage, I would have been keen to replace it with > something more light-weight... > As Dan is more active in this project again, I would like to hear his view > on replacing dynImage with this code. > The main problem we have with DynImage at the moment is, that some widgets > resize themselves to the size of an image, this fails in Mozilla/NS6/IE5.5 > (when run off a server). Would your code offer a solution for this? maybe > add an eventlistener for the onload event, and get the size then? > What I like about this code is that it uses the onload and onerror events, > instead of setting up a loop listening for the complete state. There is > however a bug in NS4.03 , which doesn't return the onload event reliably. I > personally think we should strive to support NS4 from the first versions > where possible, and an easy workaround is to let NS4.03 slip through the > preloading, more info here: > http://www.htmlguru.com/content/tutorials/curious_eye/index.html > In Dan's new proposed code, the DynAPI.onload event is depreceated, so some > rethinking would be needed there. > > > Cheers, > Richard. > > > ----- Original Message ----- > From: "Michael Bürge" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, November 11, 2001 11:13 PM > Subject: [Dynapi-Dev] image-loader > > > > there was some discussion about writing a new imageloader. > > i wrote one some time ago and this may be good moment to bring it to the > > public. > > > > the attached file provides the two classes ImageObj and ImageSet plus the > > standalone-object ImageLoader. > > > > > > ImageObj: > > basically this acts as a wrapper around the Image-Object. > > the constructor accepts 3 arguments: > > > > var myImg = new ImageObj('path/img.gif',20,20); > > > > note that after this line, the image hasn't yet been loaded. there's a > > load-method: > > > > myImg.load(new Function('alert("image loaded")')); > > > > the function (a string containig code will work too) passed as first > > argument will be called when the image has been loaded. a second function > > can be passed which is called if the image fails to load. > > > > > > ImageSet: > > this is, the name says it, a set of images. > > example: > > > > imgs = ImageSet(); > > imgs.addImage('image1','path/img1.gif',10,10); > > imgs.addImage('image2','path/img2.gif',10,10); > > ... > > ... > > imgs.load('alert("all imgs loaded")') > > > > once the ImageSet is loaded, the images can be accessed using > > getImage(name), a method that returns an ImageObj. > > > > img = imgs.getImage('image1'); > > > > this gives the advantage of having the possibility to manage images in > > groups. > > there's a lot more to mention. just a few things: > > - a base-path can be specified for each ImageSet using setImgPath(path) > > - the load-method accepts a second argument. it should be a function or a > > string containing code which the is called whenever an image of the set is > > loaded. > > > > > > ImageLoader: > > the purpose of the ImageLoader is to load all ImageObjs and ImageSets that > > have been created before loadtime automagically. this is done by adding a > > loadfunction to the DynAPI delaying the call of DynAPI.onload (by > > overwriting it). > > it provides three hook: > > ImageLoader.onloaderstart = function() { /* code here */ } > > ImageLoader.onloaderprogress = function() { /* code here */ } > > ImageLoader.onloaderdone = function() { /* code here */ } > > its pretty easy to set up a nice progressbar with these. > > > > > > that's not all that could be said. there are a few usefull comment in the > > code, so have a look at it. > > i've been using this for some time now and it prooves pretty robust. > > > > comments? questions? > > > > -- > > Michael Buerge > > > > > > > _______________________________________________ > Dynapi-Dev mailing list > [EMAIL PROTECTED] > http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/ _______________________________________________ Dynapi-Dev mailing list [EMAIL PROTECTED] http://www.mail-archive.com/dynapi-dev@lists.sourceforge.net/