PDA

View Full Version : Guy's i need help with this...


Galo
04-07-2004, 02:47 AM
Hey guy's and gal's...

the problem is..
I have a menu bar, choices are : Home, Info, Contact, news, Forum
All these choises are mc's and they have the same instance names.

But now i want to do the following.
If i press the choice Home it's alpha is set to 100 from 50 in 10 frames.
But it stays white, to show the user it's activated.

Now what i am trying is this.
Whe i move my mouse over "Info" the alpha of the "Home" button has to be set back to 50.

_root.menu.home._alpha = 50;
_root.menu.home.gotoAndPlay(11);

this is both posible
but now i wan't to change home in this line for a variabele "button"
so i can say, button = "home"

_root.menu. + button + .gotoAndPlay(11);

But this is not working, does anyone knows how i can set the variable inbetween the path ?

kind regards,
Galo

prt1
04-07-2004, 03:16 AM
This should work for you:-
button = "home";
_root.menu[button]._alpha = 50;

Galo
04-07-2004, 03:21 AM
yeah, but what about the dot syntaxt then

because the path has to be set to _root.menu.home._alpha = 50;
if i put home as button, menu[button], he put's down menu.home ?

divarch
04-07-2004, 03:43 AM
If I understood correctly you are trying to reuse the same piece of code for all buttons, so I suggest you define a function to handle the fade in, and then call it with each button.
:)

Galo
04-07-2004, 04:00 AM
Hey,

That's what i did, i wrote a function but still then i have the same problem, not getting a variable inbeween my path.

button = "home";
fadeout(button);

function fadeout(button){
_root.menu[button]._alpha = 50;
}

that's what you mean not ?

divarch
04-07-2004, 05:48 AM
Hi there, you don't need a temp variable, 'button='something', because you can call it directly like :

function fadeout(button) {
_root.menu[button]._alpha = 50;
}//your piece that works
//call it for 'home' button
fadeout('home');
//or any other
fadeout('news');
fadeout('contact');

All code is on the main
Hope it helps