New to Director - need to make a drop-down menu

aahzman used Ask the Experts™
Hi there,

I'm a total newbie to Director and yet need to make a CD-based catalog, with PDF display and more... Nothing like jumping in at the deep end, huh?

The first thing I need to sort out is navigation for my catagories.  I would like it to emulate the same kind of navigation as seen here:

With the drop-down menus on mouse over.  However, I have *NO* idea where to start this with Director.  I did find something on the Macromedia website that used mouseClick to change a text field, but it didn't work quite how I want it to.

If anyone could help me out, I would *really* appreciate it!  And remember - newbie here, so easy to understand examples/instructions would be wonderful! :)

Thanks so much,

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

i would suggest that you study first the mouse event handling of director.

on mouseup, on mousedown, on mouseenter, on mouseleave, on mouseupoutside, on mousewithin.

director does have its own built in methods for windows style drop down menus.  you define a menu something like this

menu: Volume
Loud | go to frame "Loud"
Medium | go to frame "Medium"
Soft | go to frame "Soft"
Mute | go to frame "Mute"

in a text cast member, for example "volume menu"
words to the left of the pipe (|) appear as items on the menu, words to the right are the lingo commands executed when the item is clicked.

Simply instal it in the first frame of the score like this

on enterFrame
    installMenu member "Volume Menu"

done and done
Just had to do the same thing for a CD picking up the links from a database...

I ended up basing the lingo on the macromedia stuff you mentioned.

Make a function like the director example but call it using the "on mouseWithin" comand, then adjust the code to repeat while the sprite of the menu is "the mouseMember".

I detected the mouseclick on the item with an "if the stilldown = true" within the repeat.... I was worried it may be clunky but it seems to have worked.
Be carful with rolling from on list to another (I set the whole thing within an "if the stilldown = false").

Have a look at this - it is from one of my first tests (I've edited it to take out my db stuff so it will need some work)

on rollDetect
  cursor 280
  set spriteVar = the member of sprite (the rollOver)
  set the mouseDownScript to "cursor 290"
  set the mouseUpScript to "cursor 0"
  --  puts the existing title and the dropList into the menu
  titleText = the text of field spriteVar
  set dropList = ["world lit", "politics", "basketry", "football", "grant writing"]
  add dropList, 1, titleText
  set temp = EMPTY
  repeat with x in dropList
    put x & RETURN after temp
  end repeat
  --  takes away the carage return at the end of the list
  delete char (length (temp)) of temp
  put temp into field spriteVar
  --  this is the main loop that detects the line you are on
  set oldLine = 0
  if (the stilldown = false) then
    repeat while ((the mouseMember = spriteVar) and (the stilldown = false))
      if the mouseMember = spriteVar then set newLine = the mouseLine      
      else set newLine = 0
      set the forecolor of line newLine of field spriteVar = 4
      if oldLine <> newLine then
        if newLine then
          set the forecolor of line newLine of field spriteVar = 4
          set the forecolor of line oldLine of field spriteVar = 255
        else put temp into field spriteVar
        set oldLine = newLine
      end if
      if (the stilldown = true) then --put your link here using something like the mouseLine to ge the link our of an array
      end if  
    end repeat
  end if
  --  cleans up and closes - must put the link in here getting the possition of the line clicked
  put titleText into field spriteVar
  set the forecolor of field spriteVar = 255
  cursor 0

sorry - just realised some of the comments are from before I finished... please ignore the bit that says "must put the link in here....."

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial