A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Dynamic drop down menu

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Posts
    3

    Dynamic drop down menu

    Hi,I downloaded a dynamic drop down menu from Geoff stearns off the ultrashock web site, and have so far managed to customize the fields and colours.

    As i understand it when a sub menu is clicked it should load or display text in the current selection window. That is what i am stuck on. How?
    i beleive i have found the relevant part to the action script but how do i modify it.

    onClipEvent (load) {
    // -- set up names of main items here
    // -- you can add as many new sections as you want (or your computer can handle)
    mainSections = new Array("Index", "Destiny", "Personality", "Heart", "Expression");
    // -- one array for each main Section -
    subSection0 = new Array("What is Numerology", "Learn More", "To Calculate");
    subSection1 = new Array("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Eleven", "Twenty-Two");
    subSection2 = new Array("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Eleven", "Twenty-Two");
    subSection3 = new Array("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Eleven", "Twenty-Two");
    subSection4 = new Array("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Eleven", "Twenty-Two");
    // --
    // --
    // -- build the main buttons
    for (i=0; i<mainSections.length; i++) {
    attachMovie("mainButton", "main"+i, i+100);
    myButton = this["main"+i];
    myButton.subs = this["subSection"+i];
    myButton.button.value = mainSections[i];
    myButton._x = myButton._width*i;
    // -- build subsection buttons for each main button
    for (x=0; x<myButton.subs.length; x++) {
    myButton.attachMovie("subButton", "sub"+x, x);
    mySub = myButton["sub"+x];
    mySub.button.value = myButton.subs[x];
    mySub.button.outYpos = myButton._height+(mySub._height*x);
    }
    }
    // -- function that opens the subsection on rollover
    function openSubs (target) {
    for (i=0; i<this[target].subs.length; i++) {
    subMenuCounter = 0;
    this[target]["sub"+i].button.newY = this[target]["sub"+i].button.outYpos;
    currentOpen = target;
    }
    }
    // -- close subsections function
    function closeSubs (target) {
    for (i=0; i<this[target].subs.length; i++) {
    this[target]["sub"+i].button.newY = this[target]["sub"+i].button.oYpos;
    }
    }
    // - this is the fuction you would change to load content, or add more functionality to the buttons
    function doSubSection (target, sub) {
    _root.currentSelection = target +" "+ sub;
    closeSubs(currentOpen);
    }

    }
    onClipEvent (enterFrame) {
    // -- a timer that closes the menus after a certain amount of time
    subMenuCounter++;
    if (subMenuCounter>100) {
    closeSubs(currentOpen);
    subMenuCounter = 0;
    }
    }
    onClipEvent (mouseUp) {
    // -- this closes the curently open submenu if the user clicks outside of the menu
    if (!this.hitTest(_root._xmouse, _root._ymouse)) {
    closeSubs(currentOpen);
    }
    }

    any help would be appreciated
    thank you

  2. #2
    Member
    Join Date
    Aug 2006
    Location
    St Austell, Cornwall, UK
    Posts
    43

    Um i wouldnt know where 2 start

    But here is a cool tutorial that you may want to look at hope its what you kinda want.

    Because its step by step you will learn the action scripts and change whatever you want!

    Nice Tutorial

    Hope It Helps

  3. #3
    Junior Member
    Join Date
    Jan 2007
    Posts
    3
    Thank you for the response but unfortunately i'm working with flash 5 and the tut. is for flash 8.
    I will figure something else out.

    Thank you

  4. #4
    Member
    Join Date
    Aug 2006
    Location
    St Austell, Cornwall, UK
    Posts
    43

    Are you sure

    Isnt flash 5 called Flash MX or am I being dumb? The turotial is MX, MX2004 and 8 compatable if not ill find u a better 1

    Thanks

  5. #5
    Junior Member
    Join Date
    Jan 2007
    Posts
    3
    dunno, could be. Have got the MX2004 bible, but it ain't explained in their at all. Will look at the tut. again. I think the problem is in the bit in bold. linking the .rootcurrent selection to the buttons. seen a link on a diff forum and he loaded new movies for each button. just can't figure it out.Just the one paragraph is confusing me

    _root.currentSelection = target +" "+ sub;

    i understand _root.current selection being the area where the text will load.

    but
    = target+" "=sub;

    think this is the area i need to load the text.

    Sorry newbie and flash. any easier navigation bars i can download to modify?

    Basic site needs nav bar that loads new content on same screen.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center