all groups > flash actionscript > june 2004 >
You're in the

flash actionscript

group:

Actionscript Trouble can you look and comment



Actionscript Trouble can you look and comment TryingMybest
6/15/2004 9:19:57 PM
flash actionscript: Ok, so I have this menubar and when I select the menu option of choice, I want
that choice to be directed to a specific frame in the movie. Well it doesn't
work, I have labled the frames correctly, any Ideas? Can someone look at my
code anf tell me whats wrong if Anything!

Thanks in advance

stop();
var myMenu = myMenubar.addMenu("Menu");

var menu0 = Menubar.addMenu("Welcome");
var menu1 = Menubar.addMenu("Gallery");
var menu2 = Menubar.addMenu("Tours");
var menu3 = Menubar.addMenu("Bio");
myMenubar.themeColor=0xD4D0C8;


myMenubar.borderColor=0xFFFFFF;
myMenu.addMenuItem({label:"Welcome", instanceName:"Welcome"});
myMenu.addMenuItem({label:"Gallery", instanceName:"Gallery"});
myMenu.addMenuItem({label:"Tours", instanceName:"Tours"});
myMenu.addMenuItem({label:"Bio", instanceName:"Bio"});



myMenu.themeColor=0x00ff00;
myMenu.color=0x000000;
myMenu.selectionColor=0x0A246A;
myMenu.rollOverColor=0x0A246A;
myMenu.textRollOverColor =0xFFFFFF;
myMenu.textSelectedColor =0xFFFFFF;


var myMenuListener = new Object();

myMenuListener.change = function(eventObject){
var theMenu = eventObject.menu;
var theMenuItem = eventObject.MenuItem;
switch (theMenuItem)
{
case theMenu.Wecome:
// Goes to Label "Welcome" for the Welcome Page
gotoAndStop(welcome);
//gotoAndStop(scene1,Bio);
break;

case theMenu.Bio:
// Goes to Label "Bio" Bio Page
gotoAndStop(bio);
break;

case theMenu.Tours:
// Goes to Label "Tours" Tours Page
gotoAndStop(tours);
break;

case theMenu.Gallery:
// Goes to Label "Gallery" Gallery Page
gotoAndStop(gallery);
break;

default:
// error: unknown menu item
trace ("Error: Unknown menu item selected");
break;
}
}
myMenu.addEventListener("change",myMenuListener);
Re: Actionscript Trouble can you look and comment egorlebowski
6/15/2004 10:51:49 PM
I think you should remove the "theMenu." from your switch statement...and if
you are using frame labels for your gotoAndStop statements, they should be
enclosed in quotes...:

switch(theMenuItem){

case Welcome:
gotoAndStop("welcome");
break;
//etc...
}

HTH
Re: Actionscript Trouble can you look and comment TryingMybest
6/16/2004 3:53:00 AM
Ok so I made the changes suggested and here is what I get in the output window.
"Error: Unknown menu item selected" Also the code does not direct the input to
the target frame. Here is the current actionscript below, any help would be
appreciated.

stop();
var myMenu = myMenubar.addMenu("Menu1");

var menu = Menubar.addMenu("Welcome");
var menu1 = Menubar.addMenu("Gallery");
var menu2 = Menubar.addMenu("Tours");
var menu3 = Menubar.addMenu("Bio");
myMenubar.themeColor=0xD4D0C8;


myMenubar.borderColor=0xF33FFF;
myMenu.addMenuItem({label:"Welcome", instanceName:"welcome1"});
myMenu.addMenuItem({label:"Gallery", instanceName:"gallery1"});
myMenu.addMenuItem({label:"Tours", instanceName:"tours1"});
myMenu.addMenuItem({label:"Bio", instanceName:"bio1"});



myMenu.themeColor=0x00ff00;
myMenu.color=0x000000;
myMenu.selectionColor=0x0A246A;
myMenu.rollOverColor=0x0A246A;
myMenu.textRollOverColor =0xFFFFFF;
myMenu.textSelectedColor =0xFFFFFF;


var myMenuListener = new Object();

myMenuListener.change = function(eventObject){
var theMenu = eventObject.menu;
var theMenuItem = eventObject.MenuItem;
switch(theMenuItem){

case"Welcome":
// Welcome Page
gotoAndStop("welcome1");
//gotoAndStop(scene1,Bio);
break;

case"Bio":
// Bio Page
gotoAndStop("bio1");
break;

case"Tours":
// Tours Page
gotoAndStop("tours1");
break;

case"Gallery":
// Gallery Page
gotoAndStop("gallery1");
break;

default:
// error: unknown menu item
trace ("Error: Unknown menu item selected");
break;
}
}
myMenu.addEventListener("change",myMenuListener);


AddThis Social Bookmark Button