You are right : the last line "alert(pointsparcours[0]);" is called before the others in the asynchronous function. I understand more with this asynchronous way.
In other hand, I have top to push coordinates after the function in a manual way like that : pointsparcours.push(new JLngLat(3.829125957244994,42.5320983005864)); pointsparcours.push(new JLngLat(3.82919137737109,42.53218232770708)); pointsparcours.push(new JLngLat(3.829250766966372,42.53231339414168)); ... ? (Sorry but I have no workable map online at this moment). Stephane. On Sep 1, 6:20 pm, "[email protected]" <[email protected]> wrote: > On Sep 1, 9:12 am, rodsbot <[email protected]> wrote: > > > Dear, > > > I have some trouble to extract from XML file to a tab some Lat Lng > > points. > > > On the code bellow, I create a tab "pointsparcours" that will contain > > all the coordinate of the XML file. > > Where is your > map?http://groups.google.com/group/Google-Maps-API/web/suggested-posting-...http://groups.google.com/group/google-maps-api/web/why-including-a-li... > > > > > > > > > I use pointsparcours.push(pts[i]); that work fine at this point > > (alert(pointsparcours[0]); show me that the coordinate are well > > pushed). > > > The problem is that I can't get this tab data out. > > The last line alert(pointsparcours[0]); give me an "undefined" alert > > message. > > > How could I get this tab with data for an external use ? (...if > > possible). > > > Thanks !! > > > var request = GXmlHttp.create(); > > request.open("GET", "example-valmy-15.xml", true); > > request.onreadystatechange = function() { > > GXmlHttp is asynchronous, the call back function runs when the data > comes back. > > See Mike Williams' tutorial for working examples, this has the concept > discussion: > Javascript Concepts - Part 2 Asynchronous > I/Ohttp://econym.org.uk/gmap/async.htm > > > if (request.readyState == 4) { > > var xmlDoc = GXml.parse(request.responseText); > > This sends the request. > > > request.send(null); > > The request hasn't come back from the server yet. > > > alert(pointsparcours[0]); > > -- Larry -- 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.
