Menu Bar and Slides

Questions and answers about Screens-based FLA files, Behaviors, Extensions+Extensibility, Commands and so on.
Post Reply
AugustoR
Posts: 5
Joined: Mon Jun 30, 2003 5:56 pm

Menu Bar and Slides

Post by AugustoR » Tue Feb 03, 2004 6:40 pm

Hi friends,

I`m new at flash and I don`t know much about scripts, but I`m doing a far good progress using components with slides...

My question regards about using the menubar to cotrol slides or forms...

I already know how to populate a menubar, but can anyone indicate where I can find a tutorial to triger the events... In other words, how selecting an item in the menubar can I control the visibility in forms or which slide to go in presentations?

Tks a lot in advance!
Rgds, Augusto.

Jason3d
Posts: 52
Joined: Mon Jun 30, 2003 5:56 pm

Re: Menu Bar and Slides

Post by Jason3d » Wed Feb 04, 2004 6:01 am

Here you go, you can download the source file and .swf here :D
Menu Bar Demo Zip fileAll the info is in the source file.

I'll post the code here too just for reference.

Code: Select all

// the following is optional it just sets the theme color for the ui elements
// it supports 'haloOrange', 'haloBlue','haloGreen'. Halo Green is the default
// if you want to have some fun you can also put in a HEX color like "0x006699"
_global.style.setStyle("themeColor", "haloBlue")

// notice that each menu item has a unique instanceName:
// The following populates the menu1
var menu1 = myMenuBar.addMenu("File"); // top menu item name
menu1.addMenuItem({label:"Refresh Image Data", instanceName:"refreshInstance"});
menu1.addMenuItem({label:"Open", instanceName:"openInstance"});
menu1.addMenuItem({label:"Exit", instanceName:"exitInstance"});

// The following populates the menu2
var menu2 = myMenuBar.addMenu("View"); // top menu item name
menu2.addMenuItem({label:"Details View", instanceName:"detailsInstance"});
menu2.addMenuItem({label:"Item View", instanceName:"itemView"});
menu2.addMenuItem({label:"Edit View", instanceName:"editInstance"});

// The following populates the menu3
var menu3 = myMenuBar.addMenu ("About This Demo"); // top menu item name
menu3.addMenuItem({label:"About", instanceName:"aboutInstance"});

// the following sets up the click events for the menu1
var listen = new Object();
listen.change = function(evt){
 var menu1 = evt.menu;
 var item = evt.menuItem
 if (item == menu1.refreshInstance){
   myNew();
   _root.statusBar.text = "Refresh Clicked"; //replace this with your actions
 }else if (item == menu1.openInstance){
   myOpen() 
   _root.statusBar.text = "Open Clicked";//replace this with your actions
 }else if (item == menu1.exitInstance){
   myOpen() 
   _root.statusBar.text = "Exit Clicked";//replace this with your actions
 }
}
menu1.addEventListener("change",listen);

// the following sets up the click events for the menu2
var listen = new Object();
listen.change = function(evt){
 var menu2 = evt.menu;
 var item = evt.menuItem
 if (item == menu2.detailsInstance){
   myDetails();
   _root.statusBar.text = "Details Clicked";//replace this with your actions
 }else if (item == menu2.itemView){
   myStrip() 
   _root.statusBar.text = "Items Clicked";//replace this with your actions
 }else if (item == menu2.editInstance){
   myThumbs() 
   _root.statusBar.text = "Edit Clicked";//replace this with your actions
 }
}
menu2.addEventListener("change",listen);

// the following sets up the click events for the menu3
var listen = new Object();
listen.change = function(evt){
 var menu3 = evt.menu;
 var item = evt.menuItem
 if (item == menu3.aboutInstance){
   myDetails();
   _root.statusBar.text = "About Clicked - This demo by Jason3d of jason3d.com";//replace this with your actions
 }
}
menu3.addEventListener("change",listen);

// Good luck.


Have fun

Jason3d
Posts: 52
Joined: Mon Jun 30, 2003 5:56 pm

Re: Menu Bar and Slides

Post by Jason3d » Wed Feb 04, 2004 5:22 pm

If you havn't looked here already check it out for more info on the MenuBar. It also has great examples for all the other UI components.

Group Question:

Ok. Now why can't Macromedia include tutorials of this quality and usefulness in their documentation?? If they really want to get people moving to bulid their Rich Internet Applications they really need to get on the ball with the documentation. I've been a flash developer since Flash 2 and it seems like with the release of MX 2004 pro I'm going to the Documentation (not finding anything clear or useful), Going to Macromedia.com (not finding anything clear or useful), Going to half a dozen boards and reading how everyone else is haveing the same problem I am.

AugustoR
Posts: 5
Joined: Mon Jun 30, 2003 5:56 pm

Re: Menu Bar and Slides

Post by AugustoR » Thu Feb 05, 2004 4:43 am

Jason, Fantastic ! Tks a lot !

I totally agree w/ you. Macromedia facilitates with this components, but lacks of helping people to use it.... I simply don't understand... What a strategy ?!?!

Well, I am not a real programmer, but I'm doing my site, in my free time... I'll let u know if I still having problems (sure I will !)

Tks a lot again!
Augusto

Jason3d
Posts: 52
Joined: Mon Jun 30, 2003 5:56 pm

Re: Menu Bar and Slides

Post by Jason3d » Thu Feb 05, 2004 4:04 pm

Ultra Shock UI My last post was missing the link I was talking about.

jagreen78May 1 2006, 10:49 PM
Well what if I want to start out with the Menu bar just having a few buttons and no subMenus....what do I do if one of the main buttons are clicked and I want it to gotoAndStop at a certain area??

var menu1 = this.mbMenu.addMenu("Songs");
var menu2 = this.mbMenu.addMenu("Movies");
var menu3 = this.mbMenu.addMenu("Sites");

if menu1 == selected
then gotoAndStop(here);

etc.

Post Reply