On Jul 10, 1:13 pm, Lorenz <[email protected]> wrote:
> I'm sorry rossko..I'm not very good in this work..can you explain
> better how I can use the callback properly,...with an example for
> instance..or if you want I can attached my code. thanks  in advance..

Here' a simple example -
   http://econym.org.uk/gmap/basic3.htm
It happens to use GDownloadUrl to get an XML file, but its the
principle you need to see.
When the GDownloadUrl request is set up , an anonymous function is
created for the 'callback'.
When the data comes back, that function is run and parses the XML and
adds markers to the map.
EVERYTHING that needs to use the XML data must in that function, or
else there is no gaurantee that that data will be available.  It comes
when it comes, that's the nature of asynchronous fetching across the
internet.

When you understood what's going on there, look at some of the other
examples there to see how they work, like
http://econym.org.uk/gmap/directions.htm
You might find this one useful -
http://econym.org.uk/gmap/steps
intercepting the directions and modifying the display

If you've followed so far, you should be able to use what deemanth
gave you, effectively.

GEvent.addListener(gdir, 'load', function() {
           // this part is the 'anonymous callback'
        for (var i=0; i< gdir.getPolyline().getVertexCount(); i++) {
            gpoint[i] = gdir.getPolyline().getVertex(i);
        }
        // whatever else you have to do with the polyline must go here
too
}

cheers, Ross K

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