Not a javascript expert but.. google.maps.event.addListener(basemap, 'click', drawLine);
might need to be google.maps.event.addListener(basemap, 'click', drawLine(event)); ?? or I could be totally off. On Jun 13, 3:42 pm, Rick M <[email protected]> wrote: > Hey everyone, > > So I am just starting to familiarze myself with the Google Maps API and I am > seeing an error while attempting to draw a polyline on a map. > > I am working with my own version of the "Hello World" example provided in > the tutorial. I receive an error stating *"htmlfile: Unexpected call to > method or property access"* while attempting to push a second pair of > coordinates to the polyLine MVC array. The code I am working with is below: > > poly = new google.maps.Polyline(polyOptions); > > poly.setMap(basemap); > > google.maps.event.addListener(basemap, 'click', drawLine); > > function drawLine(event){ > > var newpath = poly.getPath(); > > newpath.push(event.latLng); // <= Exception thrown at this line > > newestmarker = new google.maps.Marker({ > > position: event.latLng, > > title: '#' + newpath.getLength(), > > map: basemap > > }); > } > > Does anyone have any ideas as to what I might be missing? I've searched the > forum and could not find any other cases of this exception being thrown. > Thanks! > > Rick -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" 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-js-api-v3?hl=en.
