Thanks the debug output is very usefull. If I have well understood, I need to use GXmlHttp() the way it's described by Mike William and just like I did for the drawing of the polygons (Mike William's code in fact). In that way I'll be able to use the gmarkers array outside the callback routine ?
Or maybe I don't need GXmlHttp() but only XmlHttpRequest ? what do you think ? Thanks a lot. On 29 déc, 01:10, "[email protected]" <[email protected]> wrote: > On Dec 28, 5:55 pm, "[email protected]" <[email protected]> > wrote: > > > > > On Dec 28, 5:12 pm, Brice <[email protected]> wrote: > > > > I followed your advice but I couldn't figure it out so I went again > > > onhttp://econym.org.uk/gmap/andfindanother to read data from a xml > > > file (http://econym.org.uk/gmap/basic3.htm). > > > > Here is the result > > > :http://boucard.brice.perso.neuf.fr/geoculture/geoloc/polymarkersIMG.html > > > > But I have another problem concerning the way to display markers > > > through a MarkerManager. As you can see in this page, the call to > > > display is "inside the xml parsing" (mm.addMarkers(gmarkers,9); on > > > line 250) > > > But here > > > :http://boucard.brice.perso.neuf.fr/geoculture/geoloc/polymarkersDEPIM... > > > I've put that instruction "outside", at line 258 and it doesn't work. > > > Yet I've declared the gmarkers array at line 42 and I fill this array > > > with the markers I create with gmarkers.push(marker); on line 248 > > > The GXml call is asynchronous: > > From Mike Williams' tutorial, Javascript Concept > > Part 2 Asynchronous I/Ohttp://econym.org.uk/gmap/async.htm > > > You _have_ to use the data in the call back routine (as you > > discovered). The code that doesn't work sends the request for the > > data to the server then adds the empty array to the MarkerManager. > > Later the data arrives and populates the array, but never adds the > > newly populated array to the MarkerManager. > > Here is a copy of your page to which I have added debug > output:http://www.geocodezip.com/polymarkersDEPIMG_c.html > Notice that the mm.addMarkers call happens before the xml is > processed. > > -- Larry > > > > > > I think it's a problem with the loops I use but as you have seen and > > > can see with my code (there is probably a much better way to do what > > > I'm tryong to do), I'm not a javascript familiar :/ > > > > Thanks for your help. > > > > On 24 déc, 16:17, Rossko <[email protected]> wrote: > > > > > > GEvent.addListener(vmarker, "click", function() { > > > > > for (var i=0; i<vmarkers.lenght; i++) { > > > > > vmarker.openInfoWindowHtml("Représentations > > > > > de"+vlabels[i]); > > > > > } > > > > > }); > > > > > What that looks like its intended to do is - upon a click on ANY > > > > marker, step through the whole array of vmarker and open each ones > > > > infowindow. What you would see is just the last one, as there is only > > > > one infowindow (opening it on another marker closes the previous one) > > > > > The loop wouldn't actually work though as vmarkers.lenght would be > > > > undefined (spelling?). > > > > > It is important that you put the listener code in the code where you > > > > build each marker (processing the villes XML) > > > > > In the code currently on your test page, it says > > > > GEvent.addListener(vmarkers, ... > > > > that won't work, vmarkers is a javascript array and never gets > > > > clicked. > > > > You want to attach the listener to each marker object, best to do this > > > > where you create it > > > > > Outline - > > > > Loop through XML reading 'ville' marker data > > > > create individual marker > > > > add listener to marker > > > > push marker onto array > > > > end loop > > > > add array to markermanager -- 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.
