12 Replies Latest reply on Sep 9, 2008 3:20 PM by kglad

    stylestaton.net

    Level 7
      Does anyone know how this navigation menu was built? I find it fascinating.

      http://www.stylestation.net/SSV4/index.html

      Thanks in advanced.
        • 1. Re: stylestaton.net
          kglad Adobe Community Professional & MVP
          yes. with what part of it do you need help?
          • 2. Re: stylestaton.net
            Level 7
            I need help with the easing portion. I tried putting an easing script
            on the code I have, and it doesn't work right.

            kglad wrote:
            > yes. with what part of it do you need help?
            • 3. Re: stylestaton.net
              Level 7
              To be honest, I just need to know HOW they did it.

              Thanks kglad!

              kglad wrote:
              > yes. with what part of it do you need help?
              • 4. Re: stylestaton.net
                kglad Adobe Community Professional & MVP
                that's a standard ease-out. show your easing code.
                • 5. Re: stylestaton.net
                  Level 7
                  This is what I have so far. I grabbed code from another tutorial, and I tried to put a Tween class
                  on it:

                  function doScroll() {
                  updateMajor();
                  for (var j = 0; j < totalItems; j++) {
                  var num = indexNum - j;
                  var myItem = myMenu["item" + j];
                  myItem.enabled = true;
                  if (num > 0) {
                  new Tween(myItem, "_y", Regular.easeInOut, major.yMin, major.yMin - (num * itemHeight), 1, true);
                  } else if (num < 0) {
                  new Tween(myItem, "_y", Regular.easeInOut, major.yMax, major.yMax - (num * itemHeight), 1, true);
                  } else {
                  myItem._y = major.yMin;
                  myItem.enabled = false;
                  }
                  }
                  }

                  Here is the original code from the tutorial:

                  stop();
                  //FreakyMaranara
                  var itemHeight = 30;
                  var myInfo = new Array();
                  myInfo[0] = ["one", "stuff 1", "pic01.jpg"];
                  myInfo[1] = ["two", "stuff 2", "pic02.jpg"];
                  myInfo[2] = ["three", "stuff 3", "pic03.jpg"];
                  myInfo[3] = ["four", "stuff 4", "pic04.jpg"];
                  myInfo[4] = ["five", "stuff 5", "pic05.jpg"];
                  myInfo[5] = ["six", "stuff 6", "pic06.jpg"];
                  //
                  var totalItems = myInfo.length;
                  var indexNum = 0;
                  var myMCL = new MovieClipLoader();
                  var myL = new Object();
                  myL.onLoadComplete = function(target) {
                  //
                  };
                  myMCL.addListener(myL);
                  //
                  function doPressSelect() {
                  indexNum = this.num;
                  doScroll();
                  }
                  function updateMajor() {
                  majorItem.dispTxt.text = myInfo[indexNum][0];
                  majorItem.dispMoreTxt.text = myInfo[indexNum][1];
                  myMCL.loadClip("thumbs/" + myInfo[indexNum][2], majorItem.holder);
                  }
                  function doScroll() {
                  updateMajor();
                  for (var j = 0; j < totalItems; j++) {
                  var num = indexNum - j;
                  var myItem = myMenu["item" + j];
                  myItem.enabled = true;
                  if (num > 0) {
                  myItem._y = major.yMin - (num * itemHeight);
                  } else if (num < 0) {
                  myItem._y = major.yMax - (num * itemHeight) - itemHeight;
                  } else {
                  myItem._y = major.yMin;
                  myItem.enabled = false;
                  }
                  }
                  }
                  //
                  var myMenu = this.createEmptyMovieClip("myMenu", this.getNextHighestDepth());
                  myMenu._x = 300;
                  myMenu._y = 100;
                  for (var i = 0; i < totalItems; i++) {
                  var myItem = myMenu.attachMovie("menuItem", "item" + i, i);
                  myItem.dispTxt.text = myInfo [0];
                  myItem.num = i;
                  myItem.onPress = doPressSelect;
                  if (i == indexNum) {
                  myItem.enabled = false;
                  }
                  }
                  var majorItem = myMenu.attachMovie("menuMajorItem", "item", myInfo.length);
                  var major = new Object();
                  major = majorItem.getBounds(myMenu);
                  majorItem.btnUp.onPress = function() {
                  if (indexNum > 0) {
                  indexNum--;
                  doScroll();
                  }
                  };
                  majorItem.btnDn.onPress = function() {
                  if (indexNum < totalItems-1) {
                  indexNum++;
                  doScroll();
                  }
                  };
                  majorItem.bg.onPress = function() {
                  trace(myInfo[indexNum][2]);
                  };
                  //
                  doScroll();
                  //


                  Not sure exactly how I should have went about it.

                  Thanks

                  kglad wrote:
                  > that's a standard ease-out. show your easing code.
                  • 6. Re: stylestaton.net
                    kglad Adobe Community Professional & MVP
                    use the attach code option to display code in this forum.

                    and you must import the tween class and easing functions. are you?
                    • 7. Re: stylestaton.net
                      Level 7
                      yes I am importing tween class.

                      Sorry, I didn't know about the attach code thing.
                      • 8. Re: stylestaton.net
                        kglad Adobe Community Professional & MVP
                        and the easing functions? if yes, show your import statements,
                        • 9. Re: stylestaton.net
                          Level 7
                          Sorry, I am using Thunderbird to access this forum, and there is no code attachment option.

                          This is what I have for my import statement

                          first:

                          stop();
                          // import tween classes
                          import mx.transitions.Tween;
                          import mx.transitions.easing.*;


                          And this is the code that calls the easing function:

                          function doScroll() {
                          updateMajor();
                          for (var j = 0; j < totalItems; j++) {
                          var num = indexNum - j;
                          var myItem = myMenu["item" + j];
                          myItem.enabled = true;
                          if (num > 0) {
                          new Tween(myItem, "_y", Regular.easeInOut, major.yMin, (major.yMin - (num * itemHeight)), 1, true);
                          } else if (num < 0) {
                          new Tween(myItem, "_y", Regular.easeInOut, major.yMax, major.yMax - ((num * itemHeight)) -
                          itemHeight, 1, true);
                          } else {
                          myItem._y = major.yMin;
                          myItem.enabled = false;
                          }
                          }
                          }

                          I basically want it to ease up when you click a higher number, and ease down when you click a lower
                          number.

                          Thanks
                          • 10. Re: stylestaton.net
                            kglad Adobe Community Professional & MVP
                            use the trace() function to make sure everything you're using in your tween is defined.
                            • 11. Re: stylestaton.net
                              Level 7
                              Do you have a sample of this particular menu?
                              • 12. Re: stylestaton.net
                                kglad Adobe Community Professional & MVP
                                no.