2016-12-01 15 views
0

私はDirectionsManagerクラスを使用してBing Maps v8を試しています。私はBing MapsのインタラクティブSDKに基づいて例を作成しましたBing Maps v8 - DirectionsManager - dragDropCompletedイベントエラー

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

:ドキュメントは、以下のリンクとして、dragDropCompletedイベントを記述する

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

しかし、私は私のスクリプトを実行すると、エラーが発生します:

エラー:未定義のプロパティ 'add'を読み取ることができません

誰かが私を助けることができますか?

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(); 
}); 

答えて

1

Bing Maps V8にはdragDropCompletedイベントはありません。参照したドキュメントは、古いV7マップAPIのドキュメントです。 V8ではdirectionsUpdatedイベントを使用します。 DirectionsManagerのV8ドキュメントは次のとおりです。https://msdn.microsoft.com/en-US/library/mt750375.aspx

+0

悪いです。ごめんなさい! Tnx! –

関連する問題