Removing old elements from menu.dataDescriptor

Posted on 2011-10-03
Last Modified: 2012-06-21
hi guys

I have something like  

addEventListener(MenuEvent.ITEM_ROLL_OVER, mouseRollHandler);

private function mouseRollHandler(event:MenuEvent):void{

private function displayMenu(index:Number):void
var menu:Menu = getMenuAt(index);
menu.dataDescriptor     (is of the type : mx.controls.treeClasses.DefaultDataDescriptor)
menu.dataDescriptor  has ChildCollectionCache (of type flash.utils.Dictionary)
ChildCollectionCache  has four elements


Every time a menu item is focused on, it gets added to ChildCollectionCache.

I want to keep the latest menu item which is focused and remove the rest of items everytime. anyidea how i can do it?

for example
I want to keep only object4  and remove object 3,2,1

Any help will be greatly appreciated

Question by:royjayd
    LVL 29

    Expert Comment

    Can you provide code of your implementation of MenuBar / Menu / PopupMenu no idea what component are you using???

    Author Comment

    public class RollOverMenuBar extends MenuBar {
    public function RollOverMenuBar () {
    addEventListener(MenuEvent.ITEM_ROLL_OVER, mouseRollHandler);

    private function mouseRollHandler(event:MenuEvent):void{

     private function displayMenus(index:Number):void
     isMenuHide = false;
      selectedIndex = index;
     var item:IMenuBarItemRenderer = menuBarItems[index];
     var menu:Menu = getMenuAt(index);
     if (!menu.parent)
      menu.focusEnabled = true;
      PopUpManager.addPopUp(menu, this, false);
      menu.addEventListener(MenuEvent.MENU_HIDE, menuHide, false, EventPriority.DEFAULT_HANDLER);
      var pt:Point = new Point(0, 0);, pt.y);
     private  function menuHide(event:MenuEvent):void
       var menutoremove:Menu = Menu(;
        isMenuHide = true;

    LVL 29

    Accepted Solution

    You code is incomplete I cannot understand where is your dataProvider and what items you want to update?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    First things first - Preparation We need all the part for this install and it's much nicer to have them all on hand when you need them so here's what's required. Download Eclipse 3.5 32 bit (I like the Classic flavour) from here. (http://www.e…
    This post first appeared at Oracleinaction  ( Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now