I am loading a bings(Microsoft) map through external source i.e., I am not creating the map. I want to change the color of pushpin which is already added to the map. When I use the following code:
var map = new Microsoft.Maps.Map(document.getElementById('map'), {});
var updatePrintout = setTimeout(function () {
for (var i = map.entities.getLength() - 1; i >= 0; i--) {
var pushpin = map.entities.get(i);
if (pushpin instanceof Microsoft.Maps.Pushpin) {
map.entities.removeAt(i);
pushpin.setOptions({ color:'aqua' });
map.entities.push(pushpin);
}}
}, 2000);
It resets(clears all the pushpins) the map which i don't want. Is there a way to change the color of pushpin of existing map such as obtaining reference of existing map.