Right, like most of people, you probably use html frames with "menu" and "main" for example. After the second version of "Dynamic Menu", I've note that lot of people has problems...maybe it wasn't enought clear...More, with time you'll realize that each time you look at your own script, you can make it better. That was the case for this. For example I know that, in general, a menu links a page most of the time in the same frame. There's only for special case, you need different frame target. So we'll create a new constant called "UsualFrameTarget". This for NOT input all frame target to each rubs & subrubs !!! If we don't set any target frame for a button, that is this var that will be used. wahhhhh, what a time won ! So, INPUT FRAME TARGET CONSTANTS ONLY FOR BUTTONS HAVING A DIFFERENT FRAME TARGET THAN "USUAL" ONE.
With your global constants
Set Variable: "UsualFrameTarget" = "main" Then for buttons needing different frame target : ... Set Variable: "LabelRub1" = "I" Set Variable: "URL_Rub1" = "http://www.montfort-sa.fr" Set Variable: "FrameTarget_Rub1" = "_blank" ... or for subrubs needing & gnagnagna... ... Set Variable: "LabelRub1_Subrub1" = "Subrub1" Set Variable: "URL_Rub1_Subrub1" = "http://www.arnet.fr" Set Variable: "FrameTarget_Rub1_Subrub1" = "_blank" ...Now we send to each rub (always in first keyframe) its corresponding frame target IF THERE IS !
... Set Variable: n&":URL" = eval ("URL_Rub"&n) If (eval ("FrameTarget_Rub"&n) eq "") Set Variable: n&":FrameTarget" = UsualFrameTarget Else Set Variable: n&":FrameTarget" = eval ("FrameTarget_Rub"&n) End If End Loop ...For subrubs : in second keyframe...
... Set Variable: TargetRub&"_"&z&":Label" = eval ("LabelRub"&n&"_Subrub"&z) Set Variable: TargetRub&"_"&z&":URL" = eval ("URL_Rub"&TargetRub&"_Subrub"&z) If (eval ("FrameTarget_Rub"&TargetRub&"_Subrub"&z) eq "") Set Variable: TargetRub&"_"&z&":FrameTarget" = UsualFrameTarget Else Set Variable: TargetRub&"_"&z&":FrameTarget" = eval ("FrameTarget_Rub"&TargetRub&"_Subrub"&z) End If End Loop ...We set "Get URL" actions to our couple of buttons, so let fill the frame target...
On (Release) Get URL (URL, window=FrameTarget) End On
Yeaaaaaah, you've done it ! Congratulations, I hope that, more than the menu concept, you've learned some scripting syntax and method ;-)
Ok, if this tutorial learn to you things really, don't forget to rate this cauz it take only 10 secs. As contrary, you have to know that each guy making tutorials do it for free and they spend lot of time for this ! It's the less of thing you could do...work hard.
:::: Daafy ::::
|» Level Intermediate|
Rating: 7.99 Votes: 1292
|Daafy works with Flash since 2 years but began to script (never scripted before) since few months with Flash 4. Like you, he began by downloading sources with some white nights, coffee & other...|
|Download the files used in this tutorial.|
|Download (105 kb)|
|More help? Search our boards for quick answers!|