There's a "load" event on the map that gets triggered when the map is
usable. However, you might encounter the problem that you can't listen
for that event until after the map has been created. If you try to set
up your addListener when map is undefined, it won't work.
I suspect that you might need to create something synchronously in
global context. It doesn't really matter what it is as long as it's a
GMap object. You can then trigger custom events on that object.
var foo = new GMarker(new GLatLng(0,0)); // global, syncronous
var ready = false; // global
...
// in the code that creates the map
map.setCenter(...);
ready = true;
GEvent.trigger(foo,"Ready");
...
// in the code that processes the markers
// The map might already be ready
if (ready) {
process_markers();
} else {
// listen for the ready event
GEvent.addListener(foo, "Ready", function() {
process_markers();
});
}
I assume that you've got a really good reason (I can't think of one) for
not doing it the obvious way:
// in the code that creates the map
map.setCenter(...);
process_markers()
--
Mike Williams
http://econym.org.uk/gmap
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---