I'm trying to add a custom context menu, but only for certain overlays
on a map (mostly polygons). Is there a way to do this? My code is not
working:

userRecalledPolygonData.forEach(addPolyline);

function addPolyline(element:*, index:int, arr:Array):void {
        if(element) {
                var encodedSets:Array = new Array();

                var encodedLevels:String = "B??B";
                var encoded:EncodedPolylineData = new 
EncodedPolylineData(element[0],
32,encodedLevels,4);

                encodedSets.push(encoded);

                var myPolygon:Polygon = Polygon.fromEncoded(encodedSets, new
PolygonOptions({tooltip: element[1]}));
                map.addOverlay(myPolygon);

                var my_menu:ContextMenu = new ContextMenu();
                my_menu.hideBuiltInItems();

                var my_remove = new ContextMenuItem("Remove from display");
                var my_edit = new ContextMenuItem("Edit polygon");

                my_menu.customItems.push(my_remove, my_edit);

                myPolygon.contextMenu = my_menu;

                my_remove.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,
function (e:ContextMenuEvent):void { trace("Remove: " +
element[1]); });
                my_edit.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, 
function
(e:ContextMenuEvent):void { trace("Edit: " + element[1]); });
        }
}

Error 1119: Access of possibly undefined property contextMenu through
a reference with static type com.google.maps.overlays:Polygon

-- 
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.

Reply via email to