Hi Bernattorras- Just call map.setCenter() with the new lat/lng when the user presses the button.
- pamela On Thu, Jan 15, 2009 at 9:39 AM, bernattorras <[email protected]> wrote: > > Hi! > > I'm just trying to buid a symple Flash movie wich shows different > places on a map. I've already created a map showing a single location > with one marker but I want to update the position (lat & lng) by > pressing some buttons. > > This is the code I used to create my map (It appears in the stage once > button1 is pressed). > > import com.google.maps.Map; > import com.google.maps.LatLng; > import com.google.maps.MapEvent; > import com.google.maps.MapType; > import com.google.maps.overlays.Marker; > import com.google.maps.overlays.MarkerOptions; > import com.google.maps.MapType; > import com.google.maps.LatLng; > import com.google.maps.styles.FillStyle; > import com.google.maps.styles.StrokeStyle; > import com.google.maps.MapMouseEvent; > import com.google.maps.InfoWindowOptions; > > > var lat: Number=41.23509; > var lng: Number=1.80991; > > var map:Map = new Map(); > map.x=0; > map.y=275; > map.key = "my key"; > map.setSize(new Point(300, 358)); > map.addEventListener(MapEvent.MAP_READY, onMapReady); > > function onMapReady(event:Event):void { > map.setCenter(new LatLng(lat, lng), 16, MapType.NORMAL_MAP_TYPE); > > var markerA:Marker = new Marker( > new LatLng(41.23509, 1.80991), > new MarkerOptions({ > strokeStyle: new StrokeStyle({color: 0x800000}), > fillStyle: new FillStyle({color: 0xFF8080, alpha: 0.4}), > radius: 12, > hasShadow: true > })); > map.addOverlay(markerA); > markerA.addEventListener(MapMouseEvent.CLICK, onMapClick); > } > > function onMapClick(event:MapMouseEvent):void { > map.openInfoWindow(event.latLng, > new InfoWindowOptions({title: "Title1", content: "Content1"})); > } > > > button1.addEventListener(MouseEvent.CLICK,b1); > function b1(event:MouseEvent){ > this.addChild(map); > } > > As I said, I just want to update the map, changing the LAT and LNG > position by pressing aonther buttons (button2, button3...). Anybody > could help me? As you would probably guess I'm just a beginner but I'm > so interested in learning! :) > > Thanks in advance for your help. > > Bernattorras > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
