You need to call the function the Map instance, not your array.
I believe you want something like this:
googleMap.setCenter({mapMarker:latlng, opt_zoom:7});
-Arothian
On May 18, 2:09 am, Thomas <[email protected]> wrote:
> Hi,
>
> I would like to center on a marker when I click on it and zoom in on
> it at the same time.
> To do so I thought to use the 'setCenter'-method like in Javascript
> but I can't get it to work. The error message is coming from the
> createMarker function where 'setCenter' is no function.
>
> Markers are created from xmlList...
>
> Here is some code where I try the focus on the marker clicked.
>
> private var markerObjects:Array=[];
>
> public function readXml(event:Event):void {
> var markersXML:XML=new XML(event.target.data);
> var markers:XMLList=markersXML..marker;
> var markersCount:int=markers.length();
> var i:Number
>
> for(i=0; i < markersCount; i++)
> {
> var marker:XML=markers[i];
> var name:string=mark...@name;
> var latlng:LatLng=new LatLng(mark...@lat,
> mark...@lng);
> var mapMarker:Marker=createMarker(latlng,
> name);
> googleMap.addOverlay(mapMarker);
> }
> }
>
> public function createMarker(latlng:LatLng,
> name:String):Marker
> {
> var marker:Marker=new Marker(latlng);
> var html:String="<b>" + name + "</b>"
> marker.addEventListener(MapMouseEvent.CLICK, function
> (e:MapMouseEvent):void {
> googleMap.setZoom(10);
> });
> markerObjects.setCenter({mapMarker:latlng,
> opt_zoom:7});
> return marker;
> }
>
> Could you help me out here?
>
> Thanks,
> Thomas
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---