OK, Looks like no one else can see a problem here either. Does anyone have a working example of a Tree with dynamic context menus I can compare with?
thanks, Greg --- In flexcoders@yahoogroups.com, "Greg Groves" <[EMAIL PROTECTED]> wrote: > > I'm trying to create a dynamic item in a context menu, and I'm having > a weird problem. The code: > > var node:XML = XML(lastTreeItem.itemRenderer.data); > var hideOrShow:ContextMenuItem; > if ([EMAIL PROTECTED] == null || [EMAIL PROTECTED] == "" || [EMAIL PROTECTED] > == "false") > hideOrShow = new ContextMenuItem("Hide"); > else > hideOrShow = new ContextMenuItem("Show"); > hideOrShow.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, > hideOrShowSelected); > treeMenu.customItems.push(hideOrShow); > Debug.show(treeMenu); > > The item does not show in the menu. However, if I code it explicitly: > > var hideOrShow:ContextMenuItem = new ContextMenuItem("Hide"); > hideOrShow.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, > hideOrShowSelected); > treeMenu.customItems.push(hideOrShow); > > it works. > > It actually does seem to be there, according to Debug's output: > > (flash.ui::ContextMenu)#0 > builtInItems = (flash.ui::ContextMenuBuiltInItems)#1 > forwardAndBack = false > loop = false > play = false > print = false > quality = false > rewind = false > save = false > zoom = false > customItems = (Array)#2 > [0] (flash.ui::ContextMenuItem)#3 > caption = "Show" > enabled = true > separatorBefore = false > visible = true > > SDK bug? Or am I missing something? I found some other examples of > dynamic context menus by Googing, but I don't see any differences > between their code and mine. > > thanks, > > Greg >