我目前正在研究bing地圖應用程序,並且當用戶單擊該圖釘時我似乎無法獲取信息框。我一直在關注SDK,它應該幾乎完全一樣。繼承人我有什麼:Bing地圖的信息框
// ***********************************
// Function creates a single pin
// and returns a reference to the pin
function createMapPin(latLong, sName) {
var pinImg = "imagespins/Good.png";
var pin = new Microsoft.Maps.Pushpin(latLong, {
icon: pinImg,
anchor: new Microsoft.Maps.Point(8, 8),
draggable: true,
width: 48,
height: 48
});
pin.title = sName;
pinInfobox = new Microsoft.Maps.Infobox(pin.getLocation(),
{ title: 'My Pushpin',
description: 'This pushpin is located at (0,0).',
visible: false,
offset: new Microsoft.Maps.Point(0, 15)
});
// Add handlers for the pushpin events
Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
// Hide the infobox when the map is moved.
Microsoft.Maps.Events.addHandler(map, 'viewchange', hideInfobox);
map.entities.push(pin);
map.entities.push(pinInfobox);
return pin;
}
function displayInfobox(e) {
pinInfobox.setOptions({ visible: true });
}
function hideInfobox(e) {
pinInfobox.setOptions({ visible: false });
}
的引腳都創建並添加到地圖中成功當用戶點擊引腳上它進入dispayInfoBox方法,但在MessageBox只是似乎沒有出現。
任何建議都非常appreactiate。謝謝!
謝謝你完美地解決了我的問題,謝謝! – Johnston 2012-04-07 01:39:26