MenuBar Component

How do I add an instance name to a Menu?

newsMenu = myMenuBar.addMenu(“News”);
multiMediaMenu = myMenuBar.addMenu(“Multimedia”);
multiMediaMenu.addMenuItem({label:“Music”, instanceName:“mnuMusic”});
multiMediaMenu.addMenuItem({label:“Video”, instanceName:“mnuVideo”});

so in the above code I want to an instance name to be attached to “News”. As above you can do it with menu items but can you do it with the actual menu?

don’t think so… your assigning the variable newsMenu to your menu.

you can cut out a line of code by saying


var helpMenu = myMenuBar.addMenu("help");
helpMenu.addMenuItem({label:"About", instanceName:"aboutMenuItem"});
helpMenu.addMenuItem({label:"about Digitalosophy", instanceName:"aboutDigital"});

why do you need to assign an instance name?

Hey,

In this code the listener responds only for menuItems. But I also want it to respond to Menu buttons…

ie…

In the MenuBar component I have a Menu called News with no MenuItems. I also have another Menu called Multimedia with two menuItems, Music and Video.

How do you get an event response by just clicking on News if it has no instance name?

Hope this makes sense.

var homeMenuListener = new Object();
homeMenuListener.change = function(eventData) {
var clickedMenu = eventData.menu;
var clickedMenuItem = eventData.menuItem;
switch (clickedMenuItem) {
case clickedMenu.mnuMusic :
tickertar.loadMovie(“ticker.swf”);
break;
case clickedMenu.mnuVideo :
trace (“You clicked on the video menu”);
break;
}
}
multiMediaMenu.addEventListener(“change”, homeMenuListener);
newsMenu.addEventListener(“change”, homeMenuListener);