This comment was posted by accident; it was not complete. See my next 
comment.
Sorry.

Am Donnerstag, 7. April 2016 18:31:55 UTC+2 schrieb barryhunter:
>
> Ah, ok,  wrong about inheritance. 
>
> Anyway, still guess you must be calling that code before the Maps API has 
> loaded. 
>
>
> The new fuller code doesnt actully show the creation of 
> ProjectionHelperOverlay, 
> but the code still needs to run AFTER the map API loads. ie it should 
> perhaps be in the initialize() function. 
>
>
> ... also seem to be mixed how loading the api, you have &callback=initMap 
> - but no function by that name. 
> ANd you call initialize via DOMContentLoaded
>
> ... you should stick with one method. As the api provides functionality 
> for callback, should use that. ie &callback=initialize
>
> so it should be after the API knows its loaded, and remove DOMContentLoaded 
> listener. 
>
>
>
>
> On 7 April 2016 at 17:18, 'Bost' via Google Maps JavaScript API v3 <
> google-map...@googlegroups.com <javascript:>> wrote:
>
>>  Hallo,
>> thanks for your quick response.
>> For inheritance I followed this article:
>>
>> https://developers.google.com/maps/documentation/javascript/customoverlays?hl=de#initialize
>>
>> They prefer this:
>> ProjectionHelperOverlay.prototype = new google.maps.OverlayView();
>>
>> Not Object.create.
>>
>> Here are the main parts of my code;
>>
>> <!DOCTYPE html> 
>> <html>     
>> <head>
>>         <script *async* defer type="text/javascript"         
>>         src="
>> https://maps.google.com/maps/api/js?language=de&key=MyKey&callback=
>> *initMap*"> 
>>         </script>
>>         <script type="text/javascript" src="lib/routeMain.js" ></script>
>>        <script type="text/javascript" src="other javascript 
>> files"></script>
>>         
>> </head>
>> <body>
>>
>> </body>
>>
>> </html>
>>
>> File routeMain.js:
>> var map;
>> var markerMgr;
>>
>> if (document.addEventListener) {
>>     document.addEventListener('DOMContentLoaded', function () {
>>        //called, when html and scripts are loaded.
>>         initialize();
>>     });
>>
>> function initialize() {
>>      //loads the map
>>     var latlng = new google.maps.LatLng(51.31893, 9.49601); //Kassel, 
>> Germany
>>     var myOptions = {
>>         zoom: 7,
>>         center: latlng,
>>         mapTypeControl: true,
>>         mapTypeId: google.maps.MapTypeId.ROADMAP,
>>         scaleControl: true
>>     };
>>     map = new google.maps.Map(document.getElementById("map_canvas"), 
>> myOptions);
>>
>>
>> }
>>
>>
>>
>>
>>
>>
>>
>> Am Mittwoch, 6. April 2016 17:34:44 UTC+2 schrieb barryhunter:
>>
>>>
>>>
>>>> ProjectionHelperOverlay.prototype = new google.maps.OverlayView();
>>>>
>>>
>>> That's not really correct. THat is creating the prototype as one 
>>> 'instance' of OverlayView. (It runs the function, and stores the result - 
>>> its is an object, but its not complete) 
>>>
>>> Been a while since done inheritance, with the API, but something like 
>>> this
>>>
>>> ProjectionHelperOverlay.prototype = 
>>> Object.create(google.maps.OverlayView.prototype);
>>>
>>> See also
>>>
>>> http://stackoverflow.com/questions/9812783/cannot-inherit-google-maps-map-v3-in-my-custom-class-javascript
>>>
>>>  
>>>
>>>>
>>>> When I load GoogleMapsApi synchronously the app works with no error.
>>>>
>>>>
>>> Sounds like your code is running before the API has been fully loaded. 
>>>
>>> But its hard to guess, without seeing your code. 
>>>
>>>
>>>
>>>  
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Google Maps JavaScript API v3" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to google-maps-js-api-v3+unsubscr...@googlegroups.com <javascript:>
>> .
>> To post to this group, send email to google-map...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/google-maps-js-api-v3
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at https://groups.google.com/group/google-maps-js-api-v3.
For more options, visit https://groups.google.com/d/optout.

Reply via email to