[ka-Map-users] Detecting when tile images have loaded

David Badke dbadke at uvic.ca
Thu Apr 20 14:17:24 EDT 2006


I would like to be able to detect when all of the tile images have been 
loaded - that is, get an event to trigger when the map image (or only a 
certain layer) has been fully drawn by the browser. Since there is no 
such event in ka-Map now, I have been trying to create one, with very 
limited success. I had thought I could count the number of calls to 
tile.php (which I can, in kaMap.setTile) to get a count of the number of 
images expected, then decrement the count in the tile image onload event 
hander (kaMap_imgOnLoad) as each image loads. This doesn't work; even 
when I compensate for kaMap_imgOnLoad being called for already visible 
tiles, the count hits zero when the browser has only partly finished 
drawing. I have not found any reliable way to detect when all tiles are 
loaded, so triggering an event (which in itself is easy to do with the 
event manager) is problematic - when do I trigger it?

Anyone have any ideas how this could be done?

David

-- 

David Badke
Humanities Computing and Media Center
University of Victoria, BC, Canada



More information about the ka-Map-users mailing list