Answer the question
In order to leave comments, you need to log in
YMapsML and created object events?
Tell me, I drew a map in Yandex maps. I received a link to the YMapsML file, which I successfully connected via the yandex map api. Objects are drawn, but how to intercept mouse click events on an object drawn using YMapsML instructions? For example, I want to execute alert () when clicking on a polygon :)
It's also interesting how you can change the color of a polygon when you hover over it.
Here is an example of a map: naviris.ru/posts/geoxml
Answer the question
In order to leave comments, you need to log in
Found a solution.
I registered an event listener and got the polygon number as follows:
myMap.geoObjects.events.add('click', function (e) {
// Получение ссылки на дочерний объект, на котором произошло событие.
var object = e.get('target');
console.log(object.properties.get('metaDataProperty.AnyMetaData.number'));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question