I've attached an updated DynImage. This one is much simpler than the old version, but for me its been much more useful.
You can still do DynImage.getImage(). However, the DynImage constructor is different. You say: myImage = new DynImage(DynImage.getImage("myimage.gif"),"myid"); The id is not required. Another change is the toString method of the DynImage will return an image string like: <img src="myimage.gif" id="myid" width="1" height="2"> So now you could just say: myLayer.setHTML(myImage); I don't know of any widgets that are using the DynImage constructor itself, so I think this would be a good change. Now you don't have to write out your img strings in every widget. The old version created a dynlayer for each image. I don't think this type of overhead is necessary. Robert
function DynImage(img,id) { this.img = img; this.id = id; }; DynImage.prototype.toString = function() { return "<img src=\""+this.img.src+"\""+ (this.id?" id=\""+this.id+"\"":"")+ (this.img.width?" width=\""+this.img.width+"\"":"")+ (this.img.height?" height=\""+this.img.height+"\"":"")+">"; }; DynImage.image = []; DynImage.getImage = function(src,w,h) { for (var i=0;i<DynImage.image.length;i++) { if (DynImage.image[i].img.src==src) return DynImage.image[i].img; } var index = DynImage.image.length; DynImage.image[index] = {}; if (w&&h) { DynImage.image[index].img = new Image(w,h); DynImage.image[index].img.w = w; DynImage.image[index].img.h = h; } else DynImage.image[index].img = new Image(); DynImage.image[index].img.src = src; if (!DynImage.timerId) DynImage.timerId=setTimeout('DynImage.loadercheck()',50); return DynImage.image[index].img; }; DynImage.loadercheck=function() { DynImage.ItemsDone=0; var max = DynImage.image.length; var dimg = null; for (var i=0; i<max; i++) { dimg = DynImage.image[i]; if (dimg.img.complete) { DynImage.ItemsDone+=1; if (dimg.img.w) dimg.img.width = dimg.img.w; if (dimg.img.h) dimg.img.height = dimg.img.h; } } if (DynImage.ItemsDone<max) DynImage.timerId=setTimeout('DynImage.loadercheck()',25); else DynImage.timerId=null; }; DynAPI.document.onLoad(DynImage.loaderStart);