views:

17

answers:

0

I've been trying to create a "Loading Images" message while the tiles of the Google Map are being loaded. My implementation basically goes like this:

  • When the maptypeid_changed or idle events fire, I display the loading message
  • The loading message is removed as soon as the tilesloaded event fires

The problems I'm facing are:

  • When the tiles for a map are already loaded (say in the cache or from a previous panning operation), the tilesloaded event isn't fired.
  • If the tiles for a map view aren't completely loaded and I change the map type, the tilesloaded event fires twice. I've put a workaround by setting a flag to see if a map type change is followed by a tilesloaded event, and if not, the code discards the first tilesloaded event it receives after receiving a maptypeid_changed event.

Since there is no aretilesloaded function, is there anyway I can check if the tiles are already loaded before displaying the loading message. Also, is there anyway around the double firing of the tilesloaded event or will I have to use the discarding approach?