|   | 
Icon | 
 
| 
 | 
 
 
Subject: Icon
Author: WebSpider
 In response to: Interactive Markers
Posted on: 06/22/2009 10:01:07 PM
  
An icon specifies the images used to display a GMarker on the map.
  Constructor:
  new GIcon(copy?:GIcon, image?:String)  For example, the fo 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl()); // zoom control
      map.addControl(new GMapTypeControl());  // type control
      map.setCenter(new GLatLng(37.4419, -122.1419),8);
      // Create our "tiny" marker icon
      var blueIcon = new GIcon(G_DEFAULT_ICON);
      blueIcon.image = 
         "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
                
      // Set up our GMarkerOptions object
      markerOptions = { icon:blueIcon };
      // create a marker
      var point = new GLatLng(37.4419, -122.1419);
      var marker = new GMarker(point, markerOptions);
      map.addOverlay(marker);
 
 
>  
> On 06/22/2009 08:49:51 PM  WebSpider wrote:
  
In this example, a mouse clickable marker and a mouse hoverable marker are created.
 
 
      // Display the map, with some controls and set the initial location 
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl()); // zoom control
      map.addControl(new GMapTypeControl());  // type control
      map.setCenter(new GLatLng(37.4419, -122.1419), 8);
      // A clickable marker
      var point1 = new GLatLng(37.4419, -122.1419);
      var marker1 = new GMarker(point1);
      GEvent.addListener(marker1, "click", function() {
                          marker1.openInfoWindowHtml("You just clicked on me!");
                         });
      map.addOverlay(marker1);
      // A hoverable marker
      var point2 = new GLatLng(37.4419, -123.1419);
      var marker2 = new GMarker(point2);
      GEvent.addListener(marker2, "mouseover", function() {
                          marker2.openInfoWindowHtml("You are hovering above me!");
                         });
      GEvent.addListener(marker2, "mouseout", function() {
                          marker2.closeInfoWindow();
                         });
      map.addOverlay(marker2);
  
 
References:
  | 
  | 
 
  |   
 |