tags:

views:

9

answers:

1

I create a menu with this:

menu = Menu.createMenu(parent, get_entries());
                    menu.labelField = "@label";
                    ...
        menu.show(position.x, position.y);

How can to check if the menu is still displayed?

A: 

Listen to the menuHide event of the menu; it is dispatched when the menu or a submenu is hidden. Inside the event listener, check if event.target == event.currentTarget. If they are equal, it means that the menu was just hidden - otherwise it means that the menu is still visible, but one of its submenus were just hidden.

menu.addEventListener(MeuEvent.MENU_HIDE, onHide);
private function onHide(e:Event):void
{
  if(e.target == e.currentTarget)
    trace("The main menu was just hidden");
  else
    trace("main menu is still visible, the submenu " 
            + e.target + " was just hidden");
}
Amarghosh
Great! Thanks. Works fine.
Monkeystador