it seems the (only?) way to pass custom data to a markers MapMouseEvent
listener is to to use a function closure. personally, i find function
closures to be kinda ghetto because they are not easily referenced and
make the code look ugly.


is there a way, perhaps, to add custom data to the Marker object or
even the markerOptions object? being able to set custom data object as
a property of a Marker would be more elegant, in my opinion. something
like the following:


var myCustomData:Object = new Object();
myCustomData.label = "My Marker Label";
myCustomData.index = 1;


var marker:Marker = new Marker(new LatLng(45.53329,-73.67638));
marker.data = myCustomData;
marker.addEventListener(MapMouseEvent.CLICK, mapMouseEventHandler);


private function mapMouseEventHandler(evt:MapMouseEvent):void
{
var target:Marker = evt.currentTarget;
trace("Number " + target.data.index + ": " + target.data.label);
} 

-- 
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.

Reply via email to