Hi,
(More specific code may have facilitated a faster response from the
group or more specific response.)
Anyway, going on what you've posted I've done something similar when
adding hundreds of polygons. You should be able to implement
something similar for markers.
I loop through the array of polygons (in JavaScript, but you could
just as easily do it in AS if required) and call a AS function
(example below). The function then creates the polygon and then
registers the events for it. Doing this way the id's that are passed
in should be, lets say, "known" inside the event when it is triggered.
var polygonX:Array = new Array();
function addPolygon
(id:Number,pts:String,lvs:String,zoomFactor:Number,numLevels:Number) {
polygonX[id] = Polygon.fromEncoded(
[new EncodedPolylineData(pts, zoomFactor, lvs, numLevels)],
new PolygonOptions({ strokeStyle: new StrokeStyle({
color: 0xFFFFFF,
thickness: 1,
alpha: 0.9}),
fillStyle: new FillStyle({
color: 0xFFFFFF,
alpha: 0.4})
})
);
map.addOverlay(polygonX[id]);
polygonX[id].addEventListener(MapMouseEvent.ROLL_OVER, function
(event:MapMouseEvent): void {
doSomething(id,"over");
});
polygonX[id].addEventListener(MapMouseEvent.ROLL_OUT, function
(event:MapMouseEvent): void {
doSomething(id,"out");
});
}
There may be other more effective/efficient ways to do this, but hey,
this worked for me.
On Dec 27 2009, 11:15 am, "www.landed.at" <[email protected]>
wrote:
> I am trying to keep track of markers with a custom property, which I
> can try and set at creation but which doesnt seem to stick when I try
> and retrieve it through say a click event on a particular marker.
>
> so I want to say do the following
>
> loop i times
> new marker...id=i
> ------------------------------------------------------------------------------
> click marker
> event handle -> e.currentTarget.id
>
> Anyone know how I can keep my markers knowing who they are ? Thanks
--
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.