I am trying to use the marker method addlistener(). A simplified version of what I''m trying to do: var map; var marker; map = new mxn.Mapstraction(''myMap'',''google''); map.setCenterAndZoom(new mxn.LatLonPoint(45.559242,-122.636467), 15); marker = new mxn.Marker(new mxn.LatLonPoint(45.559242, -122.636467)); marker.addData({icon: "http://mapscripting.com/examples/mashups/richter-high.png"}); map.addMarker(marker); marker.addListener(''click'', test()); However I keep getting the error: addListener is not defined. Any help appreciated. Regards, Paul Owens HotelConnect Ltd is a company registered in England and Wales with company number 2875544.VAT registration GB671842911. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/28f0dd5d/attachment.htm>
You should change the event handler. Try to use this other choice: marker.click.addHandler(test()); --- Saludos, Pablo L?pez Escob?s [image: http://idelab.uva.es/sites/all/themes/stopdesign_idelab/img/world_logo.png]<http://www.idelab.uva.es/> Pablo L?pez Escob?s Desarrollador Laboratorio de Infraestructuras de Datos Espaciales Escuela T?cnica Superior de Ingenieros de Telecomunicaci?n Universidad de Valladolid ** [image: logo.jpg] <http://www.uva.es/> 2010/4/30 Paul Owens <POwens at hotelconnect.co.uk>> I am trying to use the marker method addlistener(). A simplified version > of what I?m trying to do: > > > > var map; > > var marker; > > > > map = new mxn.Mapstraction(''myMap'',''google''); > > map.setCenterAndZoom(new mxn.LatLonPoint(45.559242,-122.636467), > 15); > > > > marker = new mxn.Marker(new mxn.LatLonPoint(45.559242, > -122.636467)); > > marker.addData({icon: " > http://mapscripting.com/examples/mashups/richter-high.png"}); > > map.addMarker(marker); > > > > marker.addListener(''click'', test()); > > > > However I keep getting the error: addListener is not defined. Any help > appreciated. > > > > > > Regards, > > Paul Owens > > > > HotelConnect Ltd is a company registered in England and Wales with company number 2875544.VAT registration GB671842911. > > > > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/b7967fa2/attachment.htm> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 1514 bytes Desc: not available URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/b7967fa2/attachment.jpeg>
Yes, the events changed with V2. Before Where 2.0 I updated the Mapstraction Sandbox to include the new syntax: http://mapstraction.appspot.com/#events 2010/4/30 Pablo L?pez Escob?s <plopesc at gmail.com>> You should change the event handler. Try to use this other choice: > > marker.click.addHandler(test()); > > --- > Saludos, > Pablo L?pez Escob?s > > [image: > http://idelab.uva.es/sites/all/themes/stopdesign_idelab/img/world_logo.png]<http://www.idelab.uva.es/> > Pablo L?pez Escob?s > Desarrollador > Laboratorio de Infraestructuras de Datos Espaciales > Escuela T?cnica Superior de Ingenieros de Telecomunicaci?n > Universidad de Valladolid > > ** > > [image: logo.jpg] <http://www.uva.es/> > > > > > > 2010/4/30 Paul Owens <POwens at hotelconnect.co.uk> > >> I am trying to use the marker method addlistener(). A simplified version >> of what I?m trying to do: >> >> >> >> var map; >> >> var marker; >> >> >> >> map = new mxn.Mapstraction(''myMap'',''google''); >> >> map.setCenterAndZoom(new mxn.LatLonPoint(45.559242,-122.636467), >> 15); >> >> >> >> marker = new mxn.Marker(new mxn.LatLonPoint(45.559242, >> -122.636467)); >> >> marker.addData({icon: " >> http://mapscripting.com/examples/mashups/richter-high.png"}); >> >> map.addMarker(marker); >> >> >> >> marker.addListener(''click'', test()); >> >> >> >> However I keep getting the error: addListener is not defined. Any help >> appreciated. >> >> >> >> >> >> Regards, >> >> Paul Owens >> >> >> >> HotelConnect Ltd is a company registered in England and Wales with company number 2875544.VAT registration GB671842911. >> >> >> >> >> _______________________________________________ >> Mapstraction mailing list >> Mapstraction at lists.mapstraction.com >> http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com >> >> > > _______________________________________________ > Mapstraction mailing list > Mapstraction at lists.mapstraction.com > http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/f974aa1f/attachment-0001.htm>
Anyone know if this will also work with Polylines, e.g.,> var myPoly = new mxn.Polyline( ... ); > myPoly.click.addHandler(function() { alert("You clicked on or in a polyline.")});
Click event is not implemented for polylines, only for markers --- Saludos, Pablo L?pez Escob?s [image: http://idelab.uva.es/sites/all/themes/stopdesign_idelab/img/world_logo.png]<http://www.idelab.uva.es/> Pablo L?pez Escob?s Desarrollador Laboratorio de Infraestructuras de Datos Espaciales Escuela T?cnica Superior de Ingenieros de Telecomunicaci?n Universidad de Valladolid ** [image: logo.jpg] <http://www.uva.es/> 2010/4/30 Lev Tsypin <lev at levelos.com>> Anyone know if this will also work with Polylines, e.g., > > var myPoly = new mxn.Polyline( ... ); > > myPoly.click.addHandler(function() { alert("You clicked on or in a > polyline.")}); >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/d5a127dd/attachment.htm> -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: image/jpeg Size: 1514 bytes Desc: not available URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100430/d5a127dd/attachment.jpeg>
Click is implemented for the map as a whole as well so you could catch the click on the map then enumerate your polylines to check for intersections. Derek On Apr 30, 2010 7:18 PM, "Pablo L?pez Escob?s" <plopesc at gmail.com> wrote: Click event is not implemented for polylines, only for markers --- Saludos, Pablo L?pez Escob?s [image: http://idelab.uva.es/sites/all/themes/stopdesign... 2010/4/30 Lev Tsypin <lev at levelos.com>> > Anyone know if this will also work with Polylines, e.g., > > var myPoly= new mxn.Polyline( ...... _______________________________________________ Mapstraction mailing list Mapstraction at lists.mapstraction.com http://lists.mapstraction.com/listinfo.cgi/mapstraction-mapstraction.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100501/47fb7717/attachment.htm>
Good tip, thanks Derek. On May 1, 2010, at 2:25 AM, Derek Fowler wrote:> Click is implemented for the map as a whole as well so you could catch the click on the map then enumerate your polylines to check for intersections. > > Derek >Lev Tsypin _____________________ Level Online Strategy, LLC 503.342.8044 levelos.com | twitter.com/levelos -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.mapstraction.com/pipermail/mapstraction-mapstraction.com/attachments/20100502/e923b1f1/attachment.htm>