I figured ths out and I had to let people know. I am sure that there
are others with the different solutions, but just in case.
Setting up the infowindow onClick with markers from a database of
course was hell especially with the arraycollection error that was
being thrown along with looping so I always got the LAST variable
entered for the marker data. I'll just shut up and show u the code:
private var list:ArrayCollection;
private function onResult(e:ResultEvent):void {
if (e.result.map != null) {
if (e.result.map.loc is ArrayCollection) {
list = e.result.map.loc;
}
else if (e.result.map.loc is ObjectProxy) {
list = new
ArrayCollection(ArrayUtil.toArray(e.result.map.loc));
}
}
for(var i:int=0; i<list.length; i++) {
map.addOverlay(createMarker());
}
function createMarker():Marker{
var point:LatLng = new LatLng(list[i].lat, list[i].lon);
var options:MarkerOptions = new MarkerOptions({tooltip:list
[i].name});
var w:InfoWindowOptions = new InfoWindowOptions({title: list[i].name,
content: list[i].address});
var marker:Marker = new Marker(point,options);
marker.addEventListener(MapMouseEvent.CLICK, function
(event:MapMouseEvent): void {
marker.openInfoWindow(w);
})
return marker;
};
}
Let me know if it helped or any explanation is needed.
--
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.