Flasher Archive

[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]


Subject: RE: [flasher] someone's dynamic menu system
From: Paul Willoughby
Date: Fri, 16 Mar 2001 17:41:06 -0000

Wasn't that Andy A? It's based on Yugo Nakamura's menu you can see at
www.yugop.com (it's the first option - tree description). He offered the
source at the time so look thru the archives at Chinwag.com, find his email
address and hassle him till he sends it to you ;)

Basic idea is duplicating and manipulating MC's based on the variables in
the text file. Here's an example that creates a menu from a text file, but
doesn't do anything as clever as Andy's:

"textfile.txt":
menuItems=3&item0=home&item1=about&item2=contact&eof=1

movieclip:
contains just a textfield with the variable name 'txt' and an invisible
button over the top
give the button an action of:
on(release){
_root.gotoAndStop(txt);
}

Place on instance of this on the main timeline but position it off stage

main timeline
frame 1-
loadVariablesNum("textfile.txt",0);
eof = 0; //for checking when the textfile is loaded

frame 2-
//nothing in here!

frame 3-
if(eof==1){
play();
} else {
//loop while we wait for variables to load
gotoAndPlay(_currentFrame - 1);
}

frame4-
//now we can build the menu with a 'for' loop.
//this example puts menu x,y at 25,25.
//it spaces the menu items by 50 pixels.
// here's the variables we'll use

anchorX = 25;
anchorY = 25;
spaceY = 50;

// that 'menuItems' variable in the textfile is what we need to decide how
many loops
// and therefore, how many buttons we get

for(var i = 0; i < menuItems;i++){
duplicateMovieClip("menuItem", "item" add i, i);
// position the buttons
_root["item" add i]._x = anchorX;
_root["item" add i]._y = anchorY + i*spaceY;
// give them some text to display
_root["item" add i].txt = eval("item" add i);
}

frame 5-
//label this frame 'home' and put your home content
stop();

frame 6-
//label this frame 'about' and put your 'about' content
stop();

frame 7-
//label this frame 'contact' and put your 'contact' content
stop();

So there you have it. I haven't checked the syntax of this example so if you
use it directly, somethings bound to be wrong in it! I give it as a general
example of how you might approach this, and their are a *lot* of different
approaches. Maybe you'd use an XML document as your source file, maybe you'd
use attachMovie instead of duplicating, maybe you'd want to load URL's as
variables that correspond to your buttons, maybe you'd like to store
information about the buttons in arrays so it's easier to associate buttons
with URL's or frame labels...the list goes on and on, and there's no right
way just different approaches, each of which might have it's own benefits
and disadvantages depending on the situation.

Hmmm..looks like I've rambled on far too long. I hope that helps you
understand something about the way a menu can be built dynamically. Now
start thinking about the bouncy physics!

paul

> -----Original Message-----
> From: Cheng, Kynan (London) [ChengKynatexchange [dot] uk [dot] ml [dot] com (mailto:ChengKynatexchange [dot] uk [dot] ml [dot] com)]
> Sent: 16 March 2001 15:21
> To: flasher from chinwag
> Subject: [flasher] someone's dynamic menu system
>
>
> Hi,
>
> I while back someone posted a link to a pretty cool
> navigation system which
> had +/- boxes and looked like a 3-D flying version of the
> explorer directory
> interface.
>
> The cool thing was that the menu was dynamically created
> based upon a text
> file.
>
> I think the text ended up saying "This is the most
> complicated menu system
> I've tried so far" or something to that effect.
>
> I'd like to find out more about the dynamic creation part of
> that work. Can
> anyone who remembers it point me to link again or postulate
> as to how it was
> done?
>
> Thanks
> Kynan




[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]