I am using LatLngBounds to zoom the map into the proper area for the
number of maps returned on a search result.
However when only one result is found, I ALWAYS get the error "we are
sorry but don't have maps at this zoom level for this region, try
zooming out"
How can I force the zoom out one level is only one result is returned?
HERE IS MY CODE:
private function parseXML(event:Event):void {
var bounds:LatLngBounds = new LatLngBounds();
var markersXML:XML = new XML(event.target.data);
var markers:XMLList = markersXML.*;
var markersCount:int = markers.length();
var i:Number;
for (i=0; i < markersCount; i++) {
var markerXml:XML = markers[i];
var type:String = markerXml.type;
var name:String = markerXml.name;
var latlng:LatLng = new LatLng(markerXml.lat,
markerXml.lng);
var url:String = markerXml.url;
var markerImage:String = markerXml.pic;
var marker:Marker = createMarker(latlng, type,
name, url,
markerImage);
bounds.extend(latlng);
map.addOverlay(marker);
}
map.setCenter(bounds.getCenter(),
map.getBoundsZoomLevel(bounds));
}
Ive tried
if (markerCount < 3) {
map.setCenter(bounds.getCenter(), map.setZoom(1)); <<This gives
errors
}else{
map.setCenter(bounds.getCenter(),
map.getBoundsZoomLevel(bounds));
}
--
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.