Hi,

when loading http://maps.google.com and searching for "Asia,Israel", I
am transfered to approximately MiddleEast,Israel.

When running the attached Flex application which does the same, and
entering Asia,Israel, clicking the "go to location" buttton, the
application takes me to Venezuela....

Any ideas.....

Thanks

Elisheva

The code:



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
                                creationComplete="onCreationComplete(event)">
        <mx:Script>
                <![CDATA[
                        //google Map
                        import com.google.maps.LatLng;
                        import com.google.maps.LatLngBounds;
                        import com.google.maps.MapOptions;
                        import com.google.maps.controls.MapTypeControl;
                        import com.google.maps.controls.PositionControl;
                        import com.google.maps.controls.ZoomControl;
                        import com.google.maps.controls.ZoomControlOptions;
                        //GClientGeocoder
                        import com.google.maps.services.ClientGeocoder;
                        import com.google.maps.services.ClientGeocoderOptions;
                        import com.google.maps.services.GeocodingEvent;

                        import flash.events.Event;
                        import com.google.maps.MapEvent;
                        import com.google.maps.MapMouseEvent;
                        import com.google.maps.Map;
                        import com.google.maps.MapType;

                        // markers
                        import com.google.maps.styles.FillStyle;
                        import com.google.maps.styles.StrokeStyle;
                        import com.google.maps.overlays.MarkerOptions;
                        import com.google.maps.overlays.Marker;

                        private var map:Map;
                        private var geocoder:ClientGeocoder;
                        private var marker:Marker;
                        private var _marker:Marker;
                        private var menu:ContextMenu;
                        private var markerLatLng:LatLng;

                        private function onCreationComplete(event:Event):void {
                                if (map) {
                                        
map.removeEventListener(MapEvent.MAP_READY, onMapReady);
                                        map = null;
                                }
                                //kazazua.com
                                if (mapContainer != null) {
                                        map = new Map();
                                        map.key = 'YOUR_GOOGLE_MAP_KEY';
                                        map.setSize(new 
Point(mapContainer.width, mapContainer.height));
                                        
map.addEventListener(MapEvent.MAP_READY, onMapReady);
        
map.addEventListener(MapEvent.MAP_PREINITIALIZE,onMapPreinitialize);
                                        mapContainer.addChild(map);
                                }
                        }

                        private function onMapPreinitialize(event:Event):void {
                                var mapOptions:MapOptions = new MapOptions();
                                mapOptions.zoom = 2;
                                //mapOptions.center = new 
LatLng(40.736072,-73.992062);
                                mapOptions.mapType = MapType.NORMAL_MAP_TYPE;
                                mapOptions.mapType = MapType.SATELLITE_MAP_TYPE;
                                mapOptions.zoom = 6;
                                map.setInitOptions(mapOptions);
                        }

                        private function resizeMap(event:Event):void {
                                map.setSize(new Point(mapContainer.width, 
mapContainer.height));
                        }

                        private function onMapReady(event:MapEvent):void {
                                geocoder = new ClientGeocoder(new
ClientGeocoderOptions({countryCode: "AU"}));

                                // 
event.target.openInfoWindow(event.target.getCenter(), new
InfoWindowOptions({title: "Hello", content: "World"}));
                                var zoomOpt:ZoomControlOptions = new
ZoomControlOptions({ buttonSize: new Point(17, 17), buttonSpacing: new
Point(4, 4), hasScrollTrack: false });
                                var zoomCon:ZoomControl = 
event.target.addControl(new
ZoomControl(zoomOpt));
                                var posCon:PositionControl = 
event.target.addControl(new
PositionControl());
                                var typeCon:MapTypeControl = 
event.target.addControl(new
MapTypeControl());
                                map.addEventListener(MapMouseEvent.CLICK, 
showLocation);
                        }

                        private function showLocation(e:MapMouseEvent):void {
                                markerLatLng = e.latLng;
                                //map.fromViewportToLatLng(new 
Point(e.target.mouseTarget.mouseX,
e.mouseTarget.mouseY));

                                var long:Number = markerLatLng.lng();
                                var lat:Number = markerLatLng.lat();



                        }

                        private function onClickFind(event:MouseEvent):void {
                                
geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
onGeocodingSuccess, false, 0, true);
                                
geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE,
onGeocodingFailure, false, 0, true);
                                geocoder.resetCache();
                                geocoder.geocode(findLatLangInput.text);
                        }

                        private function 
onGeocodingSuccess(event:GeocodingEvent):void{
                                
map.setCenter(event.response.placemarks[0].point, 13,
MapType.NORMAL_MAP_TYPE);

                                logger.text += "onGeocodingSuccess";


                        }

                        private function 
onGeocodingFailure(event:GeocodingEvent):void{
                                // try one level up because the geonames does 
not always fit with
the google maps api
                                // take off the last location and try again
                                logger.text += "onGeocodingFailure";

                        }
                ]]>
        </mx:Script>
        <mx:Canvas id="mainCanvas" width="90%" height="90%">
                <mx:VBox>
                        <mx:VBox  id="mapBox">
                                <mx:UIComponent id="mapContainer" width="400" 
height="400"/>

                        </mx:VBox>
                        <mx:TextInput id="findLatLangInput" text="Asia,Israel"/>
                        <mx:Button label="go to location" id="findLatLang"
click="onClickFind(event)"/>
                        <mx:TextArea id="logger" width="400" height="200"/>
                </mx:VBox>


        </mx:Canvas>
</mx:Application>

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