View Full Version : hideBuiltInItems() problems any ideas?

10-21-2006, 01:50 PM
Hi everyone. I'll warn you that I'm pretty much a newbie to Flex but I've been programming in other stuff for years. :o

Now what I'm trying to do is popup a customized context menu when bars on a column chart are right clicked. And I've got it working fine EXCEPT that even though I'm calling hideBuiltInItems(), it doesn't seem to be working. By that I mean all the built in items (Zoom, etc.) are there.

Here's what I've got as far as code:
private function MakeTheContextMenu():void
cmContextMenu = new ContextMenu();
beDetColSeries.contextMenu = cmContextMenu;

private function removeDefaultItems():void
// Get rid of all the standard menu items

// keep Print on there
var defaultItems:ContextMenuBuiltInItems = cmContextMenu.builtInItems;
defaultItems.print = true;

private function addCustomMenuItems():void
// First define how the labels should look
var lblOne:String = "This is label one...";
var lblTwo:String = "This is label two...";

// Now the contex menu items themselves
var cmiItemOne:ContextMenuItem = new ContextMenuItem(lblOne);
var cmiItemTwo:ContextMenuItem = new ContextMenuItem(lblTwo);

// Now put 'em in the menu

// add the handlers
cmiItemOne.addEventListener(ContextMenuEvent.MENU_ ITEM_SELECT, cmiItemOneSelectHandler);
cmiItemOne.addEventListener(ContextMenuEvent.MENU_ ITEM_SELECT, cmiItemTwoSelectHandler);

Thanks in advance, for any ideas on a solution,