it looks good, could you please post an example how to use it.
we need to make it all DynImage -compatible if we're going to
replace the old DynImage-loader with this one. 

the old DynImage.getImage(src,w,h), DynImage.onLoaderStart(), 
DynImage.onLoading() and DynImage.onLoaderDone() must work
but can make calls to the new imageloader-class' methods instead.
and i believe some widgets must be updated (ie scrollbar and scrollpane)

/martin

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED]] On Behalf Of 
> Michael Bürge
> Sent: den 11 november 2001 23:14
> To: [EMAIL PROTECTED]
> 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/

Reply via email to