yes, I am following Mikes tutorial Part 9 Making your own custom
markers.

I have defined my marker and nothing is showing now?!

here is  my code:

[code]
<script type="text/javascript">
    //<![CDATA[

    if (GBrowserIsCompatible()) {

      // A function to create the marker and set up the event window
      // Dont try to unroll this function. It has to be here for the
function closure
      // Each instance of the function preserves the contends of a
different instance
      // of the "marker" and "html" variables which will be needed
later when the event triggers.
      function createMarker(point,name,html,icontype) {
        var marker = new GMarker(point,icons[icontype]);
        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(html);
        });
        // save the info we need to use later for the side_bar
        gmarkers[i] = marker;
        htmls[i] = html;
        // add a line to the side_bar html
        side_bar_html += '<a href="javascript:myclick(' + i + ')">' +
name + '<\/a><br>';
        i++;
        return marker;
      }


        var marker = new GIcon();
      marker.image = "images/google-pin.png";
      marker.iconSize = new GSize(90, 70);
      marker.shadow = "images/google-pin-shadow.png";
      marker.shadowSize = new GSize(90, 70);
      marker.iconAnchor = new GPoint(5, 34);
      marker.infoWindowAnchor = new GPoint(5, 2);
      marker.imageMap=[9,0,6,1,4,2,2,4,0,8,0,12,1,14,2,16,5,
       19,7,23,8,26,9,30,9,34,11,34,11,30,12,26,13,24,14,21,
       16,18,18,16,20,12,20,8,18,4,16,2,15,1,13,0];

      // Display the map, with some controls and set the initial
location
      var map = new GMap2(document.getElementById("map"));
      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng(51.3992613899243,-1.32983778443008),
8);

      // Set up three markers with info windows

      var point = new GLatLng(51.4769752333875,-2.53517458867092);
      var marker = createMarker(point,'<div style="width:240px">Some
stuff to display in the First Info Window. With a <a href="http://
www.econym.demon.co.uk">Link<\/a> to my home page<\/div>')
      map.addOverlay(marker);

      var point = new GLatLng(50.8391656924497,-0.154312843280554);
      var marker = createMarker(point,'Some stuff to display in
the<br>Second Info Window')
      map.addOverlay(marker);

      var point = new GLatLng(50.8340528225749,-0.259947032613667);
      var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
      map.addOverlay(marker);

          var point = new GLatLng(51.5168824045344,-2.6926718990779);
      var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
      map.addOverlay(marker);

          var point = new GLatLng(50.954582894922,-0.145016932400171);
      var marker = createMarker(point,'Some stuff to display in
the<br>Third Info Window')
      map.addOverlay(marker);

    }

    // display a warning if the browser was not compatible
    else {
      alert("Sorry, the Google Maps API is not compatible with this
browser");
    }

    // This Javascript is based on code provided by the
    // Community Church Javascript Team
    // http://www.bisphamchurch.org.uk/
    // http://econym.org.uk/gmap/

    //]]>
    </script>
[/code]



On 21 May, 12:52, Rossko <[email protected]> wrote:
> > how can I get my custom markers to show?
>
> Try defining your icon before you use it, rather than defining it
> inside the click listener that is only invoked long after a marker has
> been placed and the user has clicked it.  Use a reference to this icon
> when creating the marker.
>
> Have a closer look at Mike's tutorials, like the 'Custom marker' one,
> and try to understand what they do.  You're not likely to get very far
> by blind copy-pasting chunks of code.
>
> --
> 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 
> athttp://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.

Reply via email to