2016-12-01 4 views
0

Ich versuche die Bing Maps v8 mit DirektionManager-Klasse. Die Dokumente beschreibt ein dragDropCompleted Ereignis, wie unten stehenden Link:Bing Maps v8 - DirectionsManager - DragDropCompleted Ereignisfehler

http://www.bing.com/api/maps/sdk/mapcontrol/isdk#directionsEvent_directionsUpdated+JS

Aber ein Fehler tritt auf, wenn ich mein Skript ausführen:

https://msdn.microsoft.com/pt-br/library/hh312802.aspx

ich ein Beispiel basierend auf Bing Maps Interactive SDK erstellt haben :

ERROR: Kann nicht lesen Eigenschaft 'add' undefinierter

Kann mir bitte jemand helfen?

var map = new Microsoft.Maps.Map(document.getElementById('myMap'), { 
    credentials: 'Your Bing Maps Key', 
    center: new Microsoft.Maps.Location(47.606209, -122.332071), 
    zoom: 12 
}); 

Microsoft.Maps.loadModule('Microsoft.Maps.Directions', function() { 
    var directionsManager = new Microsoft.Maps.Directions.DirectionsManager(map); 
    // Set Route Mode to driving 
    directionsManager.setRequestOptions({ routeMode: Microsoft.Maps.Directions.RouteMode.driving }); 

    var waypoint1 = new Microsoft.Maps.Directions.Waypoint({ address: 'Redmond', location: new Microsoft.Maps.Location(47.67683029174805, -122.1099624633789) }); 
    var waypoint2 = new Microsoft.Maps.Directions.Waypoint({ address: 'Seattle', location: new Microsoft.Maps.Location(47.59977722167969, -122.33458709716797) }); 
    directionsManager.addWaypoint(waypoint1); 
    directionsManager.addWaypoint(waypoint2); 

    Microsoft.Maps.Events.addHandler(directionsManager, 'dragDropCompleted', function() { 
     console.log('Drag & Drop Complete!'); 
    }) 

    directionsManager.calculateDirections(); 
}); 

Antwort

1

In Bing Maps V8 gibt es kein dragDropCompleted-Ereignis. Die Dokumentation, auf die Sie verwiesen haben, bezieht sich auf die ältere V7-Karten-API. Verwenden Sie in V8 einfach das directionsUpdated-Ereignis. Hier ist die V8-Dokumentation für den DirectionsManager: https://msdn.microsoft.com/en-US/library/mt750375.aspx

+0

Mein schlechtes. Es tut uns leid! Tnx! –

Verwandte Themen