Rene ---
The MenuBar parent is not considered an item, but you can add an event
handler to it with a couple of small changes to your sample code.
1. Add an initialization call for the application's creationComplete
event
2. The Script's initialization call, among other things, add a mouse
click listener to a MenuBar:
private function initListeners(): void {
this.menuBar1.addEventListener(MouseEvent.CLICK,
this.menuBarHandler);
}
3. Also in the Script's menu bar handler, check to see how many items
(children) it has, and branch accordingly:
private function menuBarHandler(event:MouseEvent): void {
if (this.menuBar1.menuBarItems.length > 0) {
// redirect the event to the item handler, etc.
}
else {
// stand-alone menu bar processing
}
}
You may also want to remove the menu bar listener when menu items are
added to it, eliminating that call and its associated overhead. The
menu item listener then takes over.
chuckb
On Dec 22, 3:50 pm, "Rene Rodriguez" <gr8jedimas...@gmail.com> wrote:
> In Flex 3, the MenuBar component does not support the itemClick event for
> top-level menu items that do not have submenus. The Language Reference
> defines the itemClick event as "Dispatched when the user selects an item in
> a pop-up submenu."
> Is there a way to access the top-level menu items?