Hi,
I need help with the mvcArray.I'm making for practise a map where
flights available between cities are shown when you put the mouse over
one city marker. So I'm creating some polylines at the "same time" on
my map triggered by an mouseover event. I'm creating the polylines
with this function below:
The lato and lono are the origin cordinates (always the same, the
cordinates of the city marker you are hovering.
The latd and lond are the destiny cordinates (which change according
to the diferrent available destiny cities).
function createLine(lato,lono,latd,lond) {
flightPath = new google.maps.Polyline({
path: [new google.maps.LatLng(lato, lono), new
google.maps.LatLng(latd, lond)],
strokeColor: "#FF0000",
strokeOpacity: 0.5,
strokeWeight: 4
});
flightPath.setMap(map1);
}
So various polylines are created fine when I do my hover. But they
don't disapear when I mouseout. My question is: how can I use the
mvcArray to remove those polylines? After looking at the tutorials at
"
code.google" I've seen something it may help:
- mvcArray.getAt(i).removeAt()
Then I tried on my code:
google.maps.event.addListener(cityMarker, 'mouseout', function() {
mvcArray.getAt(1).removeAt(); // the 1 is to try the
array(which has more than 2 polylines)
}
I tought all the polylines where collected by that mvcArray, but when
I call it, firebug tells me it's not defined. So, I may have to define
it, how can I do it correctly?
Thanks!