From: <no...@so...> - 2001-01-16 18:41:01
|
Bug #129033, was updated on 2001-Jan-16 10:40 Here is a current snapshot of the bug. Project: DynAPI 2 Category: API Extentions Status: Open Resolution: None Bug Group: None Priority: 5 Submitted by: camhart Assigned to : nobody Summary: new DynImage('src') does not always find src in loadimages Details: When you create a new DynImage from a path, it checks the loadimages array for an image with the that path that exists already. i've been creating dynimages by passing an absolute path to the image without the host part. because the browser adds the host to src in the image object, when i create a new dynimage from the same path my image is not found in loadimages array. here's an example: myImage1 = new DynImage('/images/button.gif'); Now DynImage.loadimages has one image in it. myImage2 = new DynImage('/images/button.gif'); DynImage.loadimages now has 2 images in it, because when it was looking for '/images/button.gif' it only found 'http://hostname/images/button.gif' I modifed DynImage.getImage to fix the problem. It seems to work, here's my new function: DynImage.getImage=function(src,w,h) { for (var i=0;i<DynImage.loadimages.length;i++) { if (DynImage.loadimages[i].img.src_orig==src) { return DynImage.loadimages[i].img; } } DynImage.loadimages[i] = {}; if (w&&h) DynImage.loadimages[i].img = new Image(w,h); else DynImage.loadimages[i].img = new Image(); DynImage.loadimages[i].complete = false; DynImage.loadimages[i].img.src=DynImage.loadimages[i].img.src_orig=src; return DynImage.loadimages[i].img; }; For detailed info, follow this link: http://sourceforge.net/bugs/?func=detailbug&bug_id=129033&group_id=5757 |