[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Removing old elements from menu.dataDescriptor

Posted on 2011-10-03
3
Medium Priority
?
342 Views
Last Modified: 2012-06-21
hi guys

I have something like  

addEventListener(MenuEvent.ITEM_ROLL_OVER, mouseRollHandler);
...

private function mouseRollHandler(event:MenuEvent):void{
if(event.item.hasOwnProperty("children")){
displayMenu(event.index);
}
}

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

object4
object3
object2
object1

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

thanks
0
Comment
Question by:royjayd
  • 2
3 Comments
 
LVL 29

Expert Comment

by:dgofman
ID: 36906973
Can you provide code of your implementation of MenuBar / Menu / PopupMenu no idea what component are you using???
0
 

Author Comment

by:royjayd
ID: 36911824
public class RollOverMenuBar extends MenuBar {
public function RollOverMenuBar () {
super();
addEventListener(MenuEvent.ITEM_ROLL_OVER, mouseRollHandler);
}

private function mouseRollHandler(event:MenuEvent):void{
if(event.item.hasOwnProperty("children")){
displayMenus(event.index);
}
}

 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);
    menu.show(pt.x, pt.y);
    }
 private  function menuHide(event:MenuEvent):void
    {
   var menutoremove:Menu = Menu(event.target);
    isMenuHide = true;
   PopUpManager.removePopUp(menutoremove);

      }      
      
}
0
 
LVL 29

Accepted Solution

by:
dgofman earned 2000 total points
ID: 36918683
You code is incomplete I cannot understand where is your dataProvider and what items you want to update?
0

Featured Post

A Cyber Security RX to Protect Your Organization

Join us on December 13th for a webinar to learn how medical providers can defend against malware with a cyber security "Rx" that supports a healthy technology adoption plan for every healthcare organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
LinkedIn blogging is great for networking, building up an audience, and expanding your influence as well. However, if you want to achieve these results, you need to work really hard to make your post worth liking and sharing. Here are 4 tips that ca…
Integration Management Part 2
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

872 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