For anyone who is frustrated that you can't add right-click options to
map overlays in the Flash API, I figured this out that works great as
an ad-hoc solution by just manipulating MapMouseEvents and the built-
in ContextMenu object:
var myOverlay:GroundOverlay; // define as you will (i.e. Polygon,
Polyline, Marker, etc)
map.addOverlay(myOverlay);
myOverlay.addEventListener(MapMouseEvent.ROLL_OVER, overlayOn);
myOverlay.addEventListener(MapMouseEvent.ROLL_OUT, overlayOff);
function overlayOn(mapE:MapMouseEvent):void {
var my_menu:ContextMenu = new ContextMenu();
my_menu.hideBuiltInItems();
var my_remove = new ContextMenuItem("Option 1");
var my_edit = new ContextMenuItem("Option 2");
var my_get_sets = new ContextMenuItem("Option 3");
my_menu.customItems.push(my_option1, my_option2, my_option3);
contextMenu = my_menu;
}
function overlayOff(mapE:MapMouseEvent):void {
var my_menu:ContextMenu = new ContextMenu();
contextMenu = my_menu;
});
--
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.