I couldn't make the GControl to work with the Google Map AJAX API. I
am getting GControl is undefined error.

I am using the below piece of code to download the google map script

<script type="text/javascript" src="http://www.google.com/jsapi?
key=ABCDEFG"></script>

<script type="text/javascript">
    google.load("maps", "2",{"callback" : mapsLoaded});
</script>

<script type="text/javascript">
function MyControl() {}

MyControl.prototype = new GControl();

MyControl.prototype.initialize = function(map) {
        var container = document.getElementById("controldiv");
        map.getContainer().appendChild(container);
        return container;
}

MyControl.prototype.getDefaultPosition = function() {
        return new GControlPosition(G_ANCHOR_TOP_RIGHT, new GSize(10, 10));
}

function mapsLoaded() {
    var map = new GMap2(document.getElementById("map"));
    map.setCenter(new GLatLng(39.50,-98.35), 3);
    map.addControl(new MyControl());
}
</script>

The above script should give a rough idea of what I am trying to do.

I tried checking the stuff in Ajax API playground located here -
http://code.google.com/apis/ajax/playground/#map_control_custom. Looks
like they are using a different url form to download the script. The
url looked like
<script src="http://maps.google.com/maps?
file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q"></
script>

But this didn't work for me either.

--~--~---------~--~----~------------~-------~--~----~
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