Try using MapOptions to better configure your map on startup. You'll
have to use the map's preinitialize event.
var map:Map = new Map();
map.key = "your-key-here";
map.setSize(new Point(1500, 2350 ));
map. addEventListener(MapEvent.MAP_PREINITIALIZE,
initMap);
map.addEventListener(MapEvent.MAP_READY, onMapReady);
private function initMap(event:MapEvent):void {
var opts:MapOptions = new MapOptions();
opts.center = new LatLng(42.366662,-71.106262);
opts.zoom = 11;
opts.mapType = MapType.NORMAL_MAP_TYPE;
opts.mapTypes = [MapType.NORMAL_MAP_TYPE,
MapType.HYBRID_MAP_TYPE, MapType.SATELLITE_MAP_TYPE];
map.setInitOptions(opts);
}
private function onMapReady(event:MapEvent):void {
map.addControl(new ZoomControl());
map.addControl(new MapTypeControl());
map.addControl(new PositionControl());
map.enableScrollWheelZoom();
map.enableContinuousZoom();
}
In my opinion the Flash API allows for better extension of the core
functionality.
On Mar 3, 4:10 am, DiegoGlez <[email protected]> wrote:
> Im trying to add the three buttons to select " HYBRID, MAP, SATELLITE
> " on my map..
> Here is what i hav so far..
>
> import com.google.maps.Map;
> import com.google.maps.LatLng;
> import com.google.maps.MapEvent;
> import com.google.maps.MapType;
> import com.google.maps.controls.MapTypeControl;
> import com.google.maps.controls.ZoomControl;
> import com.google.maps.controls.PositionControl;
>
> var map:Map = new Map();
> map.key =
> "ABQIAAAALL3U5nZb2Kxn_u3L_pniBhQ3rV7oDkq_b3vpyq6tp4CquZubFRR3k3rlIQcFLkGgR2
> NRjnIuQ0lwyA";
> map.setSize(new Point(1500, 2350 ));
> map.addEventListener(MapEvent.MAP_READY, onMapReady);
>
> this.addChild(map);
> //function onMapReady(event:Event):void {
> //map.setCenter(new LatLng(27.52776,-107.31445), 5,
> MapType.HYBRID_MAP_TYPE); }
> function onMapReady(event:MapEvent):void {
> map.setCenter(new LatLng(42.366662,-71.106262), 11,
> MapType.NORMAL_MAP_TYPE);
>
> map.addControl(new ZoomControl());
> map.addControl(new PositionControl());
> map.addControl(new MapTypeControl());
> map.enableScrollWheelZoom();
> map.enableContinuousZoom();
> }
>
> I really want to get into writing AS3 to control the Google API...
> what are the advantages of Flex???
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---