Hi Flexa,
thank you for your help. But the code didn´t work. I don´t know how to
put this code inside my code. This is what I´m doing:
import com.google.maps.LatLng;
import com.google.maps.LatLngBounds;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapType;
import com.google.maps.LatLngBounds;
import com.google.maps.MapMouseEvent;
import com.google.maps.InfoWindowOptions;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.controls.ZoomControl;
import com.google.maps.controls.PositionControl;
import com.google.maps.controls.MapTypeControl;
import fl.controls.Label;
import flash.display.LoaderInfo;
var map:Map;
map = new Map();
map.key = "my API Key";
map.addEventListener(MapEvent.MAP_READY, onMapReady);
this.addChild(map);
function onMapReady(event:Event):void {
mc_carregando.visible = true;
map.enableScrollWheelZoom();
map.enableContinuousZoom();
map.addControl(new PositionControl());
map.addControl(new MapTypeControl());
map.addControl(new ZoomControl());
map.setSize(new Point(747, 496));
map.x = 252;
map.y = 93;
gc = new ClientGeocoder();
gc.addEventListener
(GeocodingEvent.GEOCODING_SUCCESS,handleGeocodingSuccess);
gc.addEventListener
(GeocodingEvent.GEOCODING_FAILURE,handleGeocodingFailure);
getXml();
}
function getXml():void {
var xmlArquivo:URLLoader = new URLLoader();
xmlArquivo.load(new URLRequest("http://www.mysite.com.br/xml_data.php?
id=3453245345234"));
xmlArquivo.addEventListener(Event.COMPLETE, readXml);
}
function readXml(event:Event):void{
var markersXML:XML = new XML(event.target.data);
var quant_nos = markersXML.status;
aSlider.maximum = (quant_nos.length())-1;
var latitude:String;
var longitude:String;
if (markersXML.hasChildNodes) {
latitude = markersXML.status[0].latitude;
longitude = markersXML.status[0].longitude;
}
gc.geocode(new LatLng(Number(latitude),Number(longitude)));
function handleGeocodingSuccess(e:GeocodingEvent):void {
var placemarks:Array = e.response.placemarks;
}
map.setCenter(new LatLng(Number(latitude),Number(longitude)),
15,
MapType.NORMAL_MAP_TYPE);
var markerA:Marker = new Marker(new
LatLng(Number(latitude),Number
(longitude)));
map.clearOverlays();
map.addOverlay(markerA);
var mapBounds = map.getLatLngBounds();
var markerLatLng = markerA.getLatLng();
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
This code is returning this error:
1046: Type was not found or was not a compile-time constant:
GeocodingEvent.
The question is: where I put this method?
"ClientGeocoder.reverseGeocode()"
I want to click the marker in the map that opens a ballon with the
address of the place. I´m really confused. : (
Thanks,
Luciano Fernandes
On 4 dez, 18:40, Flexa <[EMAIL PROTECTED]> wrote:
> oh sorry...
>
> you have to send your request ;)
>
> gc.geocode( "YourLatLngData" );
>
> On Dec 4, 9:38 pm, Flexa <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > 1. you have to init the map and wait until the map is ready:
> > map.addEventListener(MapEvent.MAP_READY, onMapReady);
>
> > 2. start your request, after the map is ready:
> > private function onMapReady(e:MapEvent):void{
> > gc = new ClientGeocoder();
> > gc.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
> > handleGeocodingSuccess);
> > gc.addEventListener(GeocodingEvent.GEOCODING_FAILURE,
> > handleGeocodingFailure);
>
> > 3. have fun with the result
> > private function handleGeocodingSuccess(e:GeocodingEvent):void {
>
> > var placemarks:Array = e.response.placemarks;
>
> > }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---