[Google Maps API v2] Re: Poly Line Set Color Option Not Working API V 2 Code attached
On Aug 18, 8:48 am, syed raza <engg.syedmoh...@gmail.com> wrote:
> i am trying to change the color of polyline on click but it color
> option not working resukting in error ... .
>
> GEvent.addListener(polyline, "click", function()
> {PolylineOptions({ strokeStyle: new StrokeStyle({color: 0xFF0000})});
No idea what your function PolylineOptions is, but if you don't have
one this won't work. There doesn't appear to be any reference to the
polyline which was actually clicked, either.
> i also try this,
>
> GEvent.addListener(polyline, "click", function()
> {polyline.setOptions(options: { strokeColor: 'blue' })};
"polyline" may not be the best way of referring to the line within the
handler function, although it may work depending on scope. However
"this" inside the handler function will always refer to the object
which has been clicked, so it's normal to use that.
But I've no idea where you got setOptions and strokeColor from. The
documentation doesn't mention those.
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GPolyline.setStrokeStyle
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GPolyStyleOptions
GEvent.addListener(polyline, "click", function()
{this.setStrokeStyle( { color: '#0000FF' }) };
--
You received this message because you are subscribed to the Google Groups "Google Maps API V2" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home