I'm using Google Maps API v3 to display a map a load some KML and display/hide them with kml.setMap() method.
I need to display a "loading" window while the KML is loading until the map is complete loaded.
I tried to use something like this:
google.maps.event.addListener(map, 'tilesloaded', function() {
var d = new Date();
console.log('Loaded: ' + d);
});
google.maps.event.addListener(map, 'bounds_changed', function() {
var d = new Date();
console.log('Started: ' + d);
});
But it didn't worked as expected.
The "titlesloaded" event is not fired always, probably because the cached images?
Here is my log:
Started: Tue Mar 29 2011 16:22:03 GMT-0300 (BRT) <-- started loading map
Loaded: Tue Mar 29 2011 16:22:06 GMT-0300 (BRT) <-- done loading map
Started: Tue Mar 29 2011 16:22:30 GMT-0300 (BRT) <-- started plotting the KML
Started: Tue Mar 29 2011 16:22:30 GMT-0300 (BRT) <-- started plotting the KML (again?!)
Loaded: Tue Mar 29 2011 16:22:32 GMT-0300 (BRT) <-- done plotting the KML
And received nothing while hiding/showing the KML again