Wasn't it ChrisB who wrote:
>My question is how can I store that overlay for use at a later point.
>I originally thought that declaring the overlay variable outside the
>scope and instantiating it in the scope may be enough, but no such
>luck.

That will work, but only if the code that you use to display the
variable "later" really is later in time. It won't work if the code is
just further down the page but executed before the callback.

For example, this won't work:

  var polyline;

  GDownloadUrl(url,function(data) {
    ...
    polyline = ...;
  });

  map.addOverlay(polyline);

because the map.addOverlay() gets processed immediately after the
GDownloadUrl request is sent. Some time later, the reply comes back from
the server, the callback function then gets called and the polyline is
created, but by then it's too late.

The normal thing to do is to call everything that relies on the results
of the GDownloadUrl from inside the callback function.


If you don't understand asynchronous I/O, try reading this:
        http://econym.org.uk/gmap/async.htm

-- 
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to