Hi, I made a map wich displays a marker with an info window that shows
up some information once the user clicks the marker. What I'm trying
to do now is to add some buttons that, once pressed, replace the
center of the map and the latitude and longitude of the marker (also
changing the content of the info window).
This is the code I used to set up the map and the initial marker:
var map:Map = new Map();
map.x=0;
map.y=291;
map.key = "MY KEY";
map.setSize(new Point(359.9, 337));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
this.addChild(map);
function onMapReady(event:Event):void {
map.setCenter(new LatLng(41.23509, 1.80991), 16,
MapType.NORMAL_MAP_TYPE);
map.addControl(new PositionControl());
map.addControl(new ZoomControl());
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, mAclick);
}
function mAclick(event:MapMouseEvent):void {
map.openInfoWindow(event.latLng,
new InfoWindowOptions({title: "Marker A info", content: "more
info"}));
}
What I'm trying to do now is to add some buttons (placed in another
frame, inside a movieClip) that are able to change the marker
position, the title, content and position f the window and the center
of the map.
I already made a button wich is able to change the map's center, but I
dont know how to change the markers position and the window contents.
This is the code:
my_mc.button1.addEventListener(MouseEvent.CLICK,button_click)
function button_click(e:MouseEvent):void {
map.setCenter(new LatLng(41.23509, 1.80991), 16,
MapType.NORMAL_MAP_TYPE);
}
Hope someone know how o do it....
thanks a lot! :)
Bernat Torras
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---