ok after some some some some messing about today i have got an end
result. Though i hope someone has a better way of doing this as it
seems long winded to me.
Set a variable to hold the maker outside of the function to remove it
var addMapPOI:*
Function to add marker to the map
function addPOI(evt:Event) {
//Create new marker on the map
var marker:Marker = new Marker(map.getCenter(), new MarkerOptions
({draggable: true}));
addMapPOI=marker
marker.addEventListener(MapMouseEvent.DRAG_END, function
(event:Event):void {
var options:InfoWindowOptions = new InfoWindowOptions({
customContent: new gForm(),
.....
map.addEventListener("_CLOSED_",poiClosed);
map.addOverlay(marker);
In the infoWindow i have a gForm attached to an external class
The close button fires the _CLOSED_ event
function closeForm(e:Event) {
parent.parent.parent.parent.parent.dispatchEvent(new Event
("_CLOSED_"));
}
this in turn fires another function to close the window and remove the
marker
function poiClosed(evt) {
map.removeOverlay(addMapPOI);
map.closeInfoWindow();
}
is there a more elegant way?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---