hi thank you for your response
i checked this http://www.geocodezip.com/\DirectionsInfoWindow.html
and i seems very logical but i don't know why it's not working with
me,
i think it's something to do with referencing since i'm declaring the
function and events in the loop
/
*********************************************************************************************************/
var gdirections = new Array();
for (var i = tournee.length -1; i>=0 ; i--)
{
gdirections[i] = new GDirections(map);
function changeImage(z) {
var marker = gdirections[i].getMarker(z);
GEvent.addListener(marker, "click", function() {
alert("voodoo");
marker.openInfoWindowHtml(marker.getTitle());
});
}
GEvent.addListener(gdirections[i],"load", function(){
setTimeout(function() {
for (var i=0; i < this.getNumRoutes(); i++) {
changeImage(i)
}
},0);
});
listeRoutes[i] = new Array();
for (var j = 0;j<tournee[i].nbSommets ;j++)
{
listeRoutes[i][j] = (j+1) + ": " + " TITLE "+ "@" + tournee
[i].sommet[j].marker.getPoint().lat() + "," + tournee[i].sommet
[j].marker.getPoint().lng();
}
gdirections[i].loadFromWaypoints(listeRoutes[i]);
}
/
*********************************************************************************************************/
i also tried this
/
*********************************************************************************************************/
for (var i = tournee.length -1; i>=0 ; i--)
{
gdirections[i] = new GDirections(map);
listen(i)
listeRoutes[i] = new Array();
for (var j = 0;j<tournee[i].nbSommets ;j++)
{
listeRoutes[i][j] = (j+1) + ": " + " TITLE "+ "@" + tournee
[i].sommet[j].marker.getPoint().lat() + "," + tournee[i].sommet
[j].marker.getPoint().lng();
}
gdirections[i].loadFromWaypoints(listeRoutes[i]);
}
}
function listen(i)
{
GEvent.addListener(gdirections[i], "load", function(){
for (var i=0; i < this.getNumRoutes(); i++) {
changeImage(i);
}
function changeImage(i) {
var marker = this.getMarker(i);
GEvent.addListener(marker, "click", function() {
alert("voodoo");
marker.openInfoWindowHtml(marker.getTitle());
});
}
});
}
/
*********************************************************************************************************/
in the second case it doesn't recognize 'this' as gdirections[i],
although i declared gdirections = new Array() in a higher scpe
is there something wrong with the code, plz tell me how it should be
done.
thank you
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---