Hi!

I'm pretty new too, but i wrote this code that do exactly what you
need... I hope.
If you try it remember to replace URL and KEY with yours.

Hope this helps



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">

        <mx:Script>
                <![CDATA[
                        import mx.controls.Alert;
                        import com.google.maps.services.ClientGeocoder;
                        import com.google.maps.services.GeocodingEvent;
            import com.google.maps.*;

            private function onKey(event:KeyboardEvent):void
            {
                if (event.keyCode==13)
                {
                        doGeocode(inputAddress.text);
                }

            }

            private function doGeocode(address:String):void
            {
                var geocoder:ClientGeocoder=new ClientGeocoder();
                geocoder.addEventListener
(GeocodingEvent.GEOCODING_SUCCESS, success);
                geocoder.addEventListener
(GeocodingEvent.GEOCODING_FAILURE, fail);
                geocoder.geocode(address);
            }

            private function success(event:GeocodingEvent):void
            {
                map.setCenter(event.response.placemarks[0].point);
                map.setZoom(16);
            }

            private function fail(event:GeocodingEvent):void
            {
                Alert.show("Geocoding failed");
            }

                ]]>
        </mx:Script>

        <maps:Map xmlns:maps="com.google.maps.*" id="map" width="100%"
height="100%"  url="yourURL" key="yourKEY"/>

        <mx:TextInput id="inputAddress" x="10" y="20" width="394" keyUp="onKey
(event)"/>



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