Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

menubar component

Status
Not open for further replies.

MJB3K

Programmer
Jul 16, 2004
524
GB
Hi, i have a problem with the menubar component and wondering if you could help.

i have this code on the timeline:
Code:
myMenuBar.addMenu("HOME");
myMenuBar.addMenu("ABOUT");
myMenuBar.addMenu("TEAM SHEET");
myMenuBar.addMenu("RESULTS");
myMenuBar.addMenu("FORUM");
myMenuBar.addMenu("SCREENSHOTS");
myMenuBar.addMenu("SERVER IP");
How can i make it so when you click on each of those buttons, it goes to a url?

any ideas??


Regards,

Martin

Computing Help And Info:
 
I don't think you can. It is menu "items" that trigger events. What you might be able to do is group your categories and then you would be fine.

Example:
Code:
fileMenu = myMenubar.addMenu("File");
communityMenu = myMenubar.addMenu("Community");

fileMenu.addMenuItem({label:"Home",instanceName:"home"});
fileMenu.addMenuItem({label:"About",instanceName:"about");

communityMenu.addMenuItem({label:"Team Sheet",instanceName:"team"});
communityMenu.addMenuItem({label:"Forum",instanceName:"forum"});

listener = new Object();
listener.change = function(evt){
    var itemSelected = evt.menuItem.attributes.instanceName;
    switch (itemSelected){
        case "home":
            gotoAndPlay(1);
        break;
        case "about":
            gotoAndPlay("about");
        break;
        case "forums":
            getURL("myURL.htm");
        break;
    }
}
myMenubar.addEventListener("change",listener);

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top