Hi allplastic- There is a demo that shows how to add an item to the context menu here: http://code.google.com/apis/maps/documentation/flash/demogallery.html?searchquery=context&classname=
You are not allowed to remove a few of the built-in options in the menu, but you are allowed to add up to 15 items. More details are here: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/ui/ContextMenu.html - pamela On Fri, Feb 27, 2009 at 3:00 AM, alloplastic <[email protected]> wrote: > > I've seen an example in Javascript that replaces the Google Maps > standard right-click menu with a custom one. Is there a way to do > this in ActionScript? > > The way the javascript version works is by capturing the > "singlerightclick" event, something which I don't think is available > through the Flash version of the API. > > If there was a way to simply disable the standard Google Maps menu, > perhaps that would be enough to get me started. > > I appreciate any comments folks may have. > > Here is the Javascript I'm referring to, taken from > http://www.ajaxlines.com/ajax/stuff/article/context_menu_in_google_maps_api.php > : > > /Event listeners that will interact with our context menu > GEvent.addListener(oMap,"singlerightclick",function(pixel,tile) { > that.clickedPixel = pixel; > var x=pixel.x; > var y=pixel.y; > //Prevents the menu to go out of the map margins, in this case the > expected menu size is 150x110 > if (x > that.map.getSize().width - 160) { x = that.map.getSize > ().width - 160 } > if (y >that.map.getSize().height - 120) { y = that.map.getSize > ().height - 120 } > var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize > (x,y)); > pos.apply(that.contextmenu); > that.contextmenu.style.display = ""; > }); > GEvent.addListener(oMap, "move", function() { > that.contextmenu.style.display="none"; > }); > GEvent.addListener(oMap, "click", function(overlay,point) { > that.contextmenu.style.display="none"; > }); > } > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
