On Jan 17, 10:18 pm, Hari <[email protected]> wrote:
> Hi,
>
> I guess, I have done the same in my code. But it does not work...
Your syntax is incorrect for the GMarker constructor. You do this:
var marker = new GMarker(point, arrowIcon, { draggable: true });
The documentation defines 2 valid syntaxes (one of which is
depreciated):
http://code.google.com/apis/maps/documentation/reference.html#GMarker
GMarker(latlng:GLatLng, icon?:GIcon, inert?:Boolean) Creates a marker
at the passed latlng of either GPoint or GLatLng with icon or the
G_DEFAULT_ICON. If the inert flag is true, then the marker is not
clickable and will not fire any events.
(Deprecated since 2.50)
GMarker(latlng:GLatLng, opts?:GMarkerOptions) Creates a marker at the
latlng with options specified in GMarkerOptions. By default markers
are clickable & have the default icon G_DEFAULT_ICON.
(Since 2.50)
If you want to include the opts argument, you need to use the second.
Like this:
var marker = new GMarker(point, { draggable: true, icon: arrowIcon });
(if you include a third argument, it assumes you are using the
depreciated definition and makes the marker inert (which is not
clickable...).
-- Larry
>
> On Jan 16, 7:51 pm, 兴百放 <[email protected]> wrote:
>
> > 在你添加自定义图片的时候,添加一个鼠标的Onclick Event,就行了
> > 比如:
> > function createMarker(){
> > var marker = new ....
> > GEvent.addListener(marker,"click",function(){
> > //your code
> > })
>
> > }
>
> > 2010/1/16 Hari <[email protected]>
>
> > > Hi,
>
> > > I am afraid; I tried this but it doesn't help.
> > > Updated the code in given link.
>
> > > On Jan 16, 4:36 pm, Rossko <[email protected]> wrote:
> > > > > I have been trying this for last 3-4 hours, but with no success. I
> > > > > want to invoke the mouse click event on a marker, which has a custom
> > > > > image; but due to some strange reasons it is not working.
>
> > > > Your custom markers have no click targetshttp://
> > > econym.org.uk/gmap/custom.htm
>
> > > > Instead of creating from a 'blank' GIcon, you can create custom
> > > > markers from the default GIcon which ensures you don't forget to
> > > > define the essentials
> > > > mything = new gicon (G_DEFAULT_ICON) ;
>
> > > --
> > > 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]<google-maps-api%2Bunsubscribe@
> > > googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-maps-api?hl=en.
--
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.