[OpenLayers-Users] Problems with Tile.Image and destroy

Gerhard Dünnebeil Gerhard.Duennebeil at chello.at
Wed Jul 22 02:26:20 EDT 2009


Hi

fairly new to Openlayers and new to this list so first of all:

Hello to all.

Of course I came here due to a problem :-)

I need help with the following:

I have a image tile provider who isn't providing the complete grid so it 
is "normal" that some tile requests are responded with an error. I'm 
using OpenLayers 2.8.

This works fine on Firefox but leaves tiles with the "image not found" 
icon in Internet Explorer.

My idea was now to hook into the OpenLayers.Util.onImageLoadError 
callback (which works) and to simply delete the tile (which doesn't work).

This is how I do it:

(expert from the code of my special layer constructor)
...
        // We need special error handling for Internet explorer
        OpenLayers.Util.onImageLoadError = function(args) {
               OpenLayers.Tile.Image.prototype.destroy.apply(this, 
arguments);
               };
...

When my hook is executed it successfully calls "destroy" but fails in it 
when it reaches the line Image.js/140 which is 
"this.layer.events.unregister("loadend", this, this.resetBackBuffer);". 
The problem is that this.layer is undefined.

Can anybody please give me a hint (code example or pointer to 
documentation)  how this can be done better?


Thanks and best regards
Gerhard




More information about the Users mailing list