(pasted from my private answer to Doug, same subject, which 
made things clear for him)

(...)

theImage = myImage.getImage()
theImage2 = DynImage.getImage(imagePath)

theImage is a DynImage-object/widget.
theImage2 is just a native Image-object

the static DynImage.getImage(src) creates a new Image-object
with given parameter as image-source. it has a loader-checker 
which could be used to check if all images are loaded. 

DynImage.prototype.getImage() is used in the same way
as DynLayer.prototype.getHTML() for example, to get the
DynLayer's html, but instead, to receive the DynImage-object's
image-property

(...)

btw, i've posted a suggestion on the dynapi-dev list about
moving the imageloader-part of DynImage to it's own class,
to prevent this kind of confusion.. ext/imageloader or 
something like that.

/martin

> -----Original Message-----
> From: Roberto A. Peña [mailto:[EMAIL PROTECTED]] 
> Sent: den 9 november 2001 19:07
> To: 'martin ström'; [EMAIL PROTECTED]
> Subject: RE: [Dynapi-Help] preloading images
> 
> 
> I think this is private war :) BUT...
> 
> As far as I understand:
> 
> DynImage.getImage=function(src,w,h) {
> //Search if the src is already being used 
>       for (var i=0;i<DynImage.loadimages.length;i++) {
>               if (DynImage.loadimages[i].img.origsrc==src ||
> DynImage.loadimages[i].img.src==src)
> 
> //If so, then return the object in the array that its using it
>                       return DynImage.loadimages[i].img;
>       }
> 
> //Setting up the new Object
>       DynImage.loadimages[i] = {};
> 
> //Creating an Image whether w and h are null or not
>       if (w&&h) DynImage.loadimages[i].img = new Image(w,h);
>       else DynImage.loadimages[i].img = new Image();
> 
> //src of the image
>       
> DynImage.loadimages[i].img.src=DynImage.loadimages[i].img.origsrc=src;
> 
> //Adds a new property to the object so you're not getting a "native"
> Image object
>       DynImage.loadimages[i].img.dynimages=[];
> 
> //Method class Martin wrote about 
>       if (DynAPI.loaded && !DynImage.timerId) DynImage.loaderStart();
> 
> //return :)
>       return DynImage.loadimages[i].img;
> };
> 
> DynImage.prototype.getImage() is used when you're creating a 
> DynImage-object like:
> di = new DynImage("image.gif");
> alert(di.getImage());
> the static method, DynImage.getImage(src, w, h) can be used alone 
> or together with a DynImage-object,  like in this case, a preloader. 
> 
> 
> Well the way I see it, di.getImage() does exactly the same as
> DynImage.getImage(), they are 2 diferent functions (one of them is a
> method and the other one is a function) and they don’t over write them
> selves!!
> 
> Both created to get the image, BUT:
> 
> DynImage.prototype.getImage = function (imgObject) {
>       return this.img;
> };
> 
> Is used to perform an action over an object (di.getIm...) 
> [yes a method]
> 
> And
> 
> DynImage.getImage = function ()
> 
> Is a function called DynImage.getImage not a method of a 
> DynImage object
> 
> 
> Well that's what I think ;)
> 
> 
> 


_______________________________________________
Dynapi-Help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dynapi-help

Reply via email to