none
Can an event be attached to an Entity Collection of Polygons? RRS feed

  • Question

  • I've created an entity collection that displays as 3 concentric rings (think 5,10,20 mile rings). I've tried adding an event to the entity collection, but can not get the mousedown event to trigger. Can I put an event handler on a collection or am I going down the wrong path? My goal is to have the enduser be able to move the target image around the map and get data from our internal database about locations inside the target.

       function AddRings(center) {
            var circleCollection = new Microsoft.Maps.EntityCollection();
            circleCollection.push(AddCircle(center.latitude, center.longitude, .05, new MM.Color(155, 2, 2, 2)));
            circleCollection.push(AddCircle(center.latitude, center.longitude, 5, new MM.Color(255, 0, 255, 0)));
            circleCollection.push(AddCircle(center.latitude, center.longitude, 20, new MM.Color(255, 255, 0, 0)));
            circleCollection.push(AddCircle(center.latitude, center.longitude, 10, new MM.Color(255, 0, 0, 255)));
            MM.Events.addHandler(circleCollection, 'mousedown', StartDragHandler);
            MM.Events.addHandler(circleCollection, 'mouseup', EndDragHandler);
            MM.Events.addHandler(circleCollection, 'mouseout', EndDragHandler);
    
            return circleCollection;
        }

    Thanks

    John

    Monday, April 23, 2012 4:57 PM

Answers