0 Replies Latest reply on May 2, 2010 9:03 PM by bdkaat

    ActionScript help needed for website

    bdkaat

      Hey everyone,

       

      I am just beginning to learn the basics of creating web sites in flash. I posted this in site design a while ago, but no one has responded yet and I need help asap.

       

      I have been following a tutorial and have it done pretty well, but they only cover one main button, and I am at the point where I need several more, but I am doing something wrong.

       

      The tutorial is at this page: http://www.flash-game-design.com/flash-tutorials/advancedWebsite-flash-tutorial- 3.html

       

      You can skip to the end and download the .fla if you want.

       

      What I want to do specifically is to add probably 4 other main buttons that can also have drop down menus. Please be as specific as possible because the extent of my code knowledge isn't very far.

       

      Thanks in advance

       

       

      The code for the main page is as follows:

       

      menu = ["About", "Bio", "Contact"];
      this.createEmptyMovieClip("content", 1000);
      this.attachMovie("sectionBackground","mask",1001);
      mask._y = content._y=208;
      mask._x = target=68;
      content.setMask(mask);
      content._x = -1000;
      imageScrollSpeed = 5;
      xStart = 125;
      yStart = 51;
      bWidth = 79;
      bHeight = 17;
      interval = 50;
      countDown = menu.length;
      menuOpen = false;
      theTime = 0;
      buttonScrollSpeed = 2;
      for (var i = 0; i<menu.length; i++) {
      var section = content.attachMovie("section_"+menu[i], "section_"+menu[i], i+100);
      section._x = section._width*i;
      var b = this.attachMovie("subButton", "subButton"+i, countDown);
      countDown--;
      b.stop();
      b._x = xStart;
      b._y = ySwtart;
      b.interval = interval*i;
      b.target = yStart+(bHeight*i);
      b.txt = menu[i];
      b.pos = target+(i*-section._width);
      b.onPress = function() {
        target = this.pos;
        closeMenu();
        this.gotoAndStop(1);
      };
      b.onRollOver = function() {
        this.gotoAndStop(2);
      };
      b.onRollOut = function() {
        this.gotoAndStop(1);
      };
      b._visible = false;
      }
      function closeMenu() {
      for (var i = 0; i<menu.length; i++) {
        var b = this["subButton"+i];
        b._visible = false;
        b._x = xStart;
        b._y = yStart;
      }
      menuOpen = false;
      }
      mainButton.onPress = function() {
      if (!menuOpen) {
        theTime = getTimer();
        menuOpen = true;
        for (var i = 0; i<menu.length; i++) {
         _root.main["subButton"+i]._visible = true;
        }
      } else {
        closeMenu();
      }
      };
      mainButtoncopy.onPress = function() {
      if (!menuOpen) {
        theTime = getTimer();
        menuOpen = true;
        for (var i = 0; i<menu.length; i++) {
         _root.main["subButton"+i]._visible = true;
        }
      } else {
        closeMenu();
      }
      };
      function scrollButtons() {
      if (menuOpen) {
        for (var i = 0; i<menu.length; i++) {
         var b = this["subButton"+i];
         if ((theTime+b.interval)<getTimer()) {
          b._y += (b.target-b._y)/buttonScrollSpeed;
         }
        }
      }
      }
      this.onEnterFrame = function() {
      content._x += (target-content._x)/imageScrollSpeed;
      scrollButtons();
      };

      http://flag2flag.org/classifieds/CPViewItem.asp?ID=50471