View Full Version : Dynamic menu with (dynamic) rollover??
Kadezz
12-21-2001, 08:55 AM
Hi,
I created a dynamic menu, based on two arrays (one with the button text and the other for the links). But now, when you mouse over this menu, I want a box to appear with text that differs for each menu item. See what I mean?
I'm very new at Flash, and ever newer at Action Scripting, but have a to short deadline for this thing - sigh, those project leaders never understand it's more difficult that it looks!
Any hints? Thanks for any help!!
Ricod
12-21-2001, 11:44 AM
Place a dynamic textbox in a MC and make sure the height os the lines match the button height. Place this in a higher layer. Make sure its positioned according to the menu . Load the data from the array into the textbox.
Kadezz
12-21-2001, 12:06 PM
Hi Ricod, thanks for the help but could it be we're talking about different things here? The text on the buttons are okay, but when you move the mouse over the menu, I want another text to appear on the right side of this menu.
I made another MC with a box and textfield but how do I make it all work together: the dynamic menu-MC and the textbox-MC. The text in the box is also different for each menu item(button), so I guess I'll have to put it in another array.
Do I make myself clear? To me it's all becoming a blur now! :confused: ;)
Kristel
Ricod
12-21-2001, 12:26 PM
So basically, u should set a global variable that u use to keep track of what u want in the second textbox. U could have all yer buttons set that variable to a different value, either numerical or a string. Lets say u have 3 buttons :
1. Ok
2. No.
3. maybe.
They have the code :
on (release){
_root.myChoise = 1; (<-different value for different button, ok ?)
}
Now its best to use a function here (I usually place these on the first frame from where my swf starts.):
function functionName (){
_root.my2ndText = eval(_root.myArray[_root.myChoise]);
}
* note I'm assuming here U already initialised myArray.
Now U place an onClipEvent on the mc thats going to contain yer 2nd text :
onClipEvent (enterFrame){ <-could also be enterframe, not sure. check if it becomes blue
_root.EmptyMC.textField1 = _root.my2ndText;
}
If its not clear WHY I'm doing WHAT here, plz let me know.
Kadezz
12-21-2001, 12:50 PM
Hm, I do see what you want me to do, but ...
How do I give a different value to a dynamic generated button (there's only one button u see, repeated i<this.list.length times to make the menu easy maintainable through an array)
What do u mean with:
_root.EmptyMC.textField1 = _root.my2ndText;
I mean: where do the EmptyMc and textField1 come from ... excuse me my dummy questions
Ricod
12-21-2001, 01:10 PM
Okay, so your buttons get dynamic names too right ? Sumthing like :
Button+[i];
Then u can have the code :
on (release){
_root.myChoise = [i];
}
Button 1 would read i=1;, 2 would read i=2;
U'll need to state the full path to i, though.
EmptyMC is just the name I used for the clip where the 2nd textbox resides. textField1 is the variable of the dynamic textfield.
If these are your dummy questions, what are your original questions ? :) But seriously, they're not dumb questions. Really, things can get REAL blurry.
Kadezz
01-08-2002, 01:06 PM
Hi there
:rolleyes: No I haven't forgotten to reply again, I was just 'gone' for some time you know. Happy newyear everybody!
Okay, there's my temporary solution to this one
It's not yet but I really wanted, but anyway. In my scene frame actions, where I defined the arrays for the buttons text and the links, I created another one for the text in the textbox.
Then, on the button I put a rollover and (not to forget, because it won't work - I can tell) rollout to show a box next to my navigation with the suitable text in it.
So: the textbox appears next to the button where you rollover, while I really wanted it to appear at the same spot all the time.
Anyway, I got quite far for a dummy, I recon. I'll keep on trying when I have the time.
Thank you very much Ricod!
Ricod
01-08-2002, 01:38 PM
and my code doesn't even work ... *tiny voice:sorry !* It doesn't recognize [i] ...
Anyway, to get the variable i :
on (rollOver){
var Me = String(this);
var MeLength = Me.length;
if (MeLength == 7){
var i = Me.substr(-1, 1);
}else if(MeLength == 8){
var i = Me.substr(-2,2);
}
/*and here u place the code to get the values from yer other
array, like _root.myText = _root.my2ndArray[i]; */
}
Also, u can forget the length thingie here if u have less than 10 buttons. Happy new year to u too !
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.