You could create a preinitialize function and set the map center and scale
inside that. You xml code for the Google Map should contain the following
parameters:
mapevent_mappreinitialize="onMapPreinitialize(event)"
as in
<maps:Map
id="map"
key="your api key here"
mapevent_mapready="onMapReady(event)"
mapevent_mappreinitialize="onMapPreinitialize(event)"
creationCompleteEffect="fadeIn"
width="100%" height="100%" />
In your AS code you would have:
private function onMapPreinitialize(event:Event):void
{
var myMapOptions:MapOptions = new MapOptions();
myMapOptions.zoom = 6;
myMapOptions.center = new LatLng(35.50,-86.00); //put your lat-lng values
here
map.setInitOptions(myMapOptions);
}
On Thu, Jun 17, 2010 at 7:34 AM, henry <[email protected]> wrote:
> Hello guys,
>
> i ran a Google maps API but i got the cities and places in the United
> States. Is there anyway, i could modify the programme to show cities
> and places in finland and in finnish?
> here is the programme i ran:
>
> ==============================================================
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
> layout="absolute"
> creationComplete="onStartup()">
> <mx:Script>
> <![CDATA[
> import com.google.maps.services.GeocodingEvent;
> import com.google.maps.services.ClientGeocoder;
> import com.google.maps.controls.ZoomControl;
> import com.google.maps.controls.MapTypeControl;
> import com.google.maps.MapEvent;
> import com.google.maps.LatLng;
> import com.google.maps.Map;
> import mx.core.UIComponent;
>
> private var map:Map = new Map();
>
> private function onStartup() : void {
> var uic:UIComponent = new UIComponent();
> uic.setStyle( 'top', 0 );
> uic.setStyle( 'left', 0 );
> uic.width = width;
> uic.height = height;
> addChildAt( uic, 0 );
>
> map.key =
>
> 'ABQIAAAAt13sIHffD_LRvsL56_noDBT2yXp_ZAY8_ufC3CFXhHIE1NvwkxTynfLnLUHPzZkM4epR89xoF8VG2w';
> map.width = width;
> map.height = height;
> map.addEventListener( MapEvent.MAP_READY,
> onMapReady );
> uic.addChild( map );
>
> locPanel.setStyle( 'top', height -
> locPanel.height - 20 );
> }
> private function onMapReady( event:MapEvent ) : void
> {
> map.setCenter( new LatLng( 34.101509,
> -118.32691 ) );
> map.setZoom( 12 );
>
> map.addControl( new MapTypeControl() );
> map.addControl( new ZoomControl() );
> }
> private function onGeocodeSuccess(
> event:GeocodingEvent ) : void {
> map.setCenter(
> event.response.placemarks[0].point );
> }
> private function onKeyDown( event:KeyboardEvent ) :
> void {
> if ( event.keyCode == Keyboard.ENTER ) {
> var cg:ClientGeocoder = new
> ClientGeocoder();
> cg.addEventListener(
> GeocodingEvent.GEOCODING_SUCCESS,
> onGeocodeSuccess );
> cg.geocode( loc.text );
> }
> }
> ]]>
> </mx:Script>
> <mx:Panel id="locPanel" title="Location" top="500" left="20"
> borderAlpha="0.95">
> <mx:TextInput id="loc" keyDown="onKeyDown( event )"
> width="300"
> text="fremont, ca" />
> </mx:Panel>
> </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]<google-maps-api-for-flash%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api-for-flash?hl=en.
>
>
--
Bruce Ralston
Professor
Department of Geography
University of Tennessee
Knoxville, TN 37996-0925
Phone: 865-974-6043
FAX: 865-974-6025
--
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.