-
import com.google.maps.Map;
-
import com.google.maps.MapEvent;
-
import com.google.maps.MapType;
-
import com.google.maps.controls.*;
-
import com.google.maps.LatLng;
-
//IMPORTAMOS LA CLASE PARA TRABAJAR CON MARCADORES
-
import com.google.maps.overlays.*;
-
//importamos la clase para trabajar con opciones para los marcadores
-
import com.google.maps.overlays.MarkerOptions;
-
//clase para trabajar con eventos del mouse
-
import com.google.maps.MapMouseEvent;
-
//clase requerida para desplegar una ventana
-
import com.google.maps.InfoWindowOptions;
-
-
var map:Map = new Map();
-
//CREAMOS UNA VARIABLE CON EL TIPO MARKER
-
var marker:Marker;
-
-
map.key="ABQIAAAAvvxprSVgDmort-nQvP9UOBRcIBM5SEgUYyuJIuqH4Qf0kgkYgBT_K4sLwopPkxZFAw-tlQLIRz3sTA";
-
map.addEventListener(MapEvent.MAP_READY, onMapReady);
-
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
-
this.addChild(map);
-
-
function onMapReady(event:Event):void {
-
//centramos el mapa a las coordenadas deseadas (-31...,-64...) e indicamos el zoom (12) y tipo de mapa por defecto (MapType.NORMAL_MAP_TYPE)
-
map.setCenter(new LatLng(-31.409619,-64.184532), 12, MapType.NORMAL_MAP_TYPE);
-
map.addControl(new ZoomControl());
-
map.addControl(new PositionControl());
-
map.addControl(new MapTypeControl());
-
//en la libreria cramos un Sprite con el nombre de clase Icono
-
//creamos una variable opciones y guardamos el icono
-
var opciones:MarkerOptions=new MarkerOptions({icon:new Icono()});
-
//CREAMOS UN NUEVO OBJETO CON LAS COORDENADAS DEL MARCADOR
-
//y agregamos como parametro las opciones antes modificadas
-
marker=new Marker(new LatLng(-31.409619,-64.184532),opciones);
-
//Y LO AGREGAMOS A LA VISUALIZACION DEL MAPA
-
-
//agregamos un detector de evento para el clic sobre el marcador
-
marker.addEventListener(MapMouseEvent.CLICK, ClickMarket);
-
map.addOverlay(marker);
-
}
-
-
//el contenido del globo del marcador
-
var Texto:String="<b>LeoBaraldi</b> <br/> Juan de los Palotes 225"
-
-
function ClickMarket(e:MapMouseEvent):void {
-
//mostramos el globo y su contenido
-
marker.openInfoWindow(new InfoWindowOptions({contentHTML:Texto}));
-
}