Thank you ! that's what I was looking for. However when I tried to search using ctrl+space while adding event listner in the list MapZoomEvent options was not coming in the dropdown list !! So I do not know if it is a bug -not showing MapZoomEvent in inline coding help in flex builder.
but yes thanks again. -mili On Jul 10, 4:10 pm, DonD <[email protected]> wrote: > Hi Mili, > > Are you asking about how to listen for the map's zoom event? If so, > you should know there are multiple zoom-related events you can listen > for. The Google Maps API has a MapZoomEvent object with several event > names. I listen for the "ZOOM_CHANGED" event in my code which looks > like this: > > <?xml version="1.0" encoding="utf-8"?> > <mx:Application > xmlns:mx = "http://www.adobe.com/2006/mxml" > xmlns:maps = "com.google.maps.*" > layout="absolute"> > > <mx:Script> > <![CDATA[ > import com.google.maps.controls.ControlPosition; > import com.google.maps.controls.NavigationControl; > import > com.google.maps.controls.NavigationControlOptions; > import com.google.maps.LatLng; > import com.google.maps.MapOptions; > import com.google.maps.MapType; > import com.google.maps.MapZoomEvent; // Import the > MapZoomEvent > import mx.controls.Alert; > > private const MAP_API_KEY:String = > YOUR_API_KEY_HERE; > private const MAP_CENTER:LatLng = new LatLng(0, 0); > > private function onMapPreinitialize(evt:Event):void { > this.map.setInitOptions(new MapOptions({ > zoom: 1, > > center:MAP_CENTER, > > mapType: MapType.NORMAL_MAP_TYPE, > > mapTypes: [MapType.NORMAL_MAP_TYPE]})); > > } > > private function onMapReady(evt:Event):void { > // Zoom Event Listener > > map.addEventListener(MapZoomEvent.ZOOM_CHANGED, onMapZoomChanged, > false, 0, true); > > // Navigation Control > var > navigationControlOptions:NavigationControlOptions = > new > NavigationControlOptions({position: new ControlPosition > (ControlPosition.ANCHOR_TOP_RIGHT, 4, 60)}); > map.addControl(new > NavigationControl(navigationControlOptions)); > > } > > private function > onMapZoomChanged(evt:MapZoomEvent):void { > Alert.show("ZOOMED to level " + > map.getZoom().toString()); > } > ]]> > </mx:Script> > > <maps:Map id="map" key="{MAP_API_KEY}" > mapevent_mapready = "onMapReady(event)" > mapevent_mappreinitialize = "onMapPreinitialize(event)" > width="100%" height="100%"/> > > </mx:Application> > > On Jul 10, 3:46 pm, Mili <[email protected]> wrote: > > > > > How to trap zoom event on google map using flex API ? > > -thanks- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
