I've been searching for a straight solution to a problem I have since a couple of days.
For example , you need to add multiple kml layers on a map, in a specific order, then you need zIndex.
But with Google Maps API V3, you don't have such things.
Any idea?
So two things you can do.
First workaround is to add listeners: https://gist.github.com/jkeefe/1170104
Second workaround is to set timeouts between calls.
It will not take long to load a layer on a map.
In fact, not more than 10 milliseconds is necessary.
Simply add setTimeout inside the callback function of a setTimeout.
Example:
layers.setMap(map);
setTimeout(function(){
layers2.setMap(map);
setTimeout(function(){
layers3.setMap(map);
setTimeout(function(){
layers4.setMap(map);
setTimeout(function(){
layers5.setMap(map);
},400);
},100);
},100);
},100);
I used the second workaround.
If you think this thread is helpfull, then make me know, Ciao!