From: Brian H. <bg...@ke...> - 2003-09-19 20:25:58
|
Thank you for the below code, and it helped me get a little closer to my goal.. Anyone who thinks this could be better please let me know or if I am doing things right.... function ZoomObject(ImgSourceName,H,W){ this.DynLayer = DynLayer; this.DynLayer(); if(ImgSourceName==null){ return; } else { this.ImgSrc= ImgSourceName}; this.Img = []; var o = this; if(document.images){ this.Imgid = (document.images.length) ? document.images.length++:0; this.Img[this.Imgid] = new Image( (W)?W:null, (H)?H:null ); this.Img[this.Imgid].src = this.ImgSrc; this.Img[this.Imgid].onerror = function(){ alert("Error");}; this.setHTML(this.setImgHTML()); this._LoadedOnPage(); //delay just a bit. } this.css = null; // } var x = dynapi.setPrototype('ZoomObject','DynLayer'); x._LoadedOnPage = function(){ if(document.images){ if(document.images[this.Imgid] == null){ dynapi.document.addChild(this); setTimeout(this+"._LoadedOnPage()", 100); } else if( document.images[this.Imgid].complete == false){ setTimeout(this+"._LoadedOnPage()", 100); } else if( document.images[this.Imgid].complete == true){ this.setSize(document.images[this.Imgid].width,document.images[this.Imgid].h eight); this.css = document.images[this.Imgid]; this.reSize(); //alert("Loaded On Page"); } } } x.reSize = function(){ this.css.width = 100; this.css.height = 200; } x.setImgHTML = function(){ return "<img name=xImage" + this.Imgid + " id=xImage" + this.Imgid +" src=" + this.Img[this.Imgid].src + " onClick=alert(document.images[0]);>"; } -----Original Message----- From: dyn...@li... [mailto:dyn...@li...] On Behalf Of Raymond Irving Sent: Wednesday, September 17, 2003 6:18 PM To: dyn...@li... Subject: RE: [Dynapi-Help] dynapi.functions.getImage() two functions. Try this: var x1 = dynapi.functions.getImage('a.gif',10,10); for(var i in dynapi.ximages){ img = dynapi.ximages[i]; if(x1==img && img.complete){ //code here } } -- Raymond Irving --- Brian Hayes <bg...@ke...> wrote: > Can you give an example, Here is what I did and > return undef.. > > > alert(dynapi.ximages[0]); > > -----Original Message----- > From: dyn...@li... > [mailto:dyn...@li...] On > Behalf Of Raymond Irving > Sent: Wednesday, September 17, 2003 11:22 AM > To: dyn...@li... > Subject: Re: [Dynapi-Help] > dynapi.functions.getImage() two functions. > > > All should work in IE. I think NS6+,Moz,Opera does > not > work too well with the img.complete property of the > Image object, correct? > > I think you can loop through dynapi.ximages and test > for the .complete or .failed property to see if the > image was loaded or has failed. > > -- > Raymond Irving > > --- Brian Hayes <bg...@ke...> wrote: > > Hello, > > > > I have spent the past week tiring to > > take advantage of the > > captureImageProgrss(fn) feature, but without > > success. I either get mixed > > results or no results when using this feature. > > > > Example: The code below only seems to work some of > > the time.. > > > > //var oBase = this; //Get Back to this > > from the below > > function.... > > > > > //dynapi.functions.captureImageProgress(IsNextImageCompleted) > > //dynapi.functions.setImageTTL(150000) > > > > > //function > > IsNextImageCompleted(completed,failed,total){ > > // if(completed < > > total){oBase.ShowWaitObject(true);;} // Not done > > loading. > > // > > if((completed+failed)==total) { // We got > > failures. > > // var > > a=dynapi.functions.getFailedImages(); > > // for(var > > i=0;i<a.length;i++){ > > // > > a[i].reload(); > > // } > > // } > > // if (completed == total) { > > //Once completed then > > switch our visible layer with our count number, or > > the next number up. > > // > > if(oBase.getLevels() < > > oBase.getZoomCount()){ ; } else { > > oBase.switchImageLayerVisible(); }; > > // > > oBase.ShowWaitObject(false); //Hide all Wait/Stop > > objects... > > // > > oBase.switchImageLayerVisible(); > > // }; // we got them all. > > //} > > > > But, the bigger issue that I have is that I need > to > > be able to run code > > differently based on which image is downloaded. So > I > > would need to be > > able to do two of the obove, but different actions > > based on which one > > gets loaded... Not to mention, attempting to a > > custom function such as: > > But only works in IE, and not NS 7.0 ?? Any help > > would be greatly > > appreciated. > > > > p.BuildZoomLayer = function(whichLayer){ > > > if(this.Images[whichLayer].SRC.complete > > == false ){ // Our > > Image is NOT loaded... CALL ME and Check Again. > > this._ZTimer = > > > window.setTimeout(this+".BuildZoomLayer("+whichLayer+")",100); > > } else { // We loaded our image.. > > this._ZTimer = null; > > > this.Images[whichLayer].DOM > > = > > document.images[this.Images[whichLayer].ID]; // > set > > our DOM Object from > > out image object. > > } > > > > } > > > > > __________________________________ > Do you Yahoo!? > Yahoo! SiteBuilder - Free, easy-to-use web site > design software > http://sitebuilder.yahoo.com > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Dynapi-Help mailing list > Dyn...@li... > https://lists.sourceforge.net/lists/listinfo/dynapi-help __________________________________ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dynapi-Help mailing list Dyn...@li... https://lists.sourceforge.net/lists/listinfo/dynapi-help |