3 Replies Latest reply on Mar 11, 2007 10:23 PM by kglad

    Novice Navigation Woes

    BushyMark
      Hey All! I am having a doozy here . . . pulling my hair out and wearing sack cloth and ashes . . . can anyone drop me a line?

      I am trying to make this navigation scheme for a new site. The .fla I am working in is the navigation.swf that will load into the master.swf. There are a couple of things I could really use some help with.

      First of all, the buttons are movieclips with frame labels and stop actions (up, down, press). I tried to use buttons . . . but since you cannot access the button "states" in AS, I used movie clips instead. (from browsing alot of forums, this seems to be the system of choice, yes). all of the buttons have this code (with different names) attached to them:

      Actionscript:

      on (rollOver) {
      this.artMC.gotoAndPlay("down");
      }

      on (rollOut) {
      this.artMC.gotoAndPlay("up");
      }

      on (press) {
      this.artMC.gotoAndPlay("press");
      }

      on (release) {
      _root.reEnableOptions
      this.enabled = false;
      this.artMC.enabled = false;
      this.artMC.gotoAndPlay("down");
      }



      <insert nonsequitor here> While I wanted to keep all of my script in a centralized place (eg action layer, frame 1 of timeline) . . . it seemed that everyone who wrote a tutorial had ya attaching the script to the MC itself. and no matter how many times I tried to


      this.artMC.onRollOver = function() {
      this.artBtn.artMC.gotoAndPlay("down");
      }


      it was NOT workin! (bonus points for if you can explain that one to me!)</end nonsequitor>

      Anyway, here is where my problem lies. You can see that my GOAL is to have the button disabled when pressed and remain in the DOWN state. in order to re-enable the button when another button is released, I have created this function in the _root timeline, and inserted it to run in each of the buttons.

      Actionscript:

      // ReEnable the sub-menu options
      function reEnableOptions() {
      this.aboutBtn.enabled = true;
      this.aboutBtn.about.enabled = true;
      this.aboutBtn.about.gotoAndPlay("up");
      this.artBtn.enabled = true;
      this.artBtn.artMC.enabled = true;
      this.artBtn.artMC.gotoAndPlay("up");
      this.archBtn.enabled = true;
      this.archBtn.archMC.enabled = true;
      this.archBtn.archMC.gotoAndPlay("up");
      this.fashionBtn.enabled = true;
      this.fashionBtn.fashionMC.enabled = true;
      this.fashionBtn.fashionMC.gotoAndPlay("up");
      this.photoBtn.enabled = true;
      this.photoBtn.photoMC.enabled = true;
      this.photoBtn.photoMC.gotoAndPlay("up");
      this.webdesignBtn.enabled = true;
      this.webdesignBtn.webdesignMC.enabled = true;
      this.webdesignBtn.webdesignMC.gotoAndPlay("up");
      this.miscBtn.enabled = true;
      this.miscBtn.miscMC.enabled = true;
      this.miscBtn.miscMC.gotoAndPlay("up");
      }


      clearly . . . this is NOT workin! grrrr! I think my code is "sound" in idea . . . but I think I am missing something pretty fundamental here . . . can anyone lead me in the right direction?
        • 1. Re: Novice Navigation Woes
          kglad Adobe Community Professional & MVP
          for the bonus points i'll opine that your reference to this (inside the rollOver handler) is incorrect. but it's also possible your reference to this.artMC is incorrect, too.

          anyway for your buttons:

          • 2. Re: Novice Navigation Woes
            BushyMark Level 1
            ok . . . so I found out that my function on the root timeline wasn't being called because I forgot to place the (); after the

            _root.reEnableOptions

            but I ran into more problems because this function isn't setting all buttons to "up" . . . it is flipping all of them to the opposite of what they are presently set at! (grrrrr!) . . . so I thought I would try a modified version of your previousBtn idea(which is brilliant!), due to the fact that I disable the movie clip that reveals the button, and the movie clip inside with the "button state" timeline. Here is what I came up with

            on (rollOver) {
            this.miscMC.gotoAndPlay("down");
            }

            on (rollOut) {
            this.miscMC.gotoAndPlay("up");
            }

            on (press) {
            this.miscMC.gotoAndPlay("press");
            }

            on (release) {
            this.enabled = false;
            this.miscMC.enabled = false;
            this.miscMC.gotoAndPlay("down");
            previousBtn.enabled = true;
            previousBtn.gotoAndPlay("up");
            previousBtn = this.miscMC;
            previousMC.enabled = true;
            previousMC = this;
            }

            for each button i changed the variable (eg this.miscMC would become this.artMC for the nested art movieclip). When this didn't work, I decided to try and get more specific and tried this:

            on (release) {
            this.enabled = false;
            this.miscMC.enabled = false;
            this.miscMC.gotoAndPlay("down");
            previousBtn.enabled = true;
            previousBtn.gotoAndPlay("up");
            previousBtn = miscBtn.miscMC;
            previousMC.enabled = true;
            previousMC = this;
            }

            unfortunately, using a more specific entry didn't work either . . . the buttons still do not re-enable, and they don't switch to the "up" position . . .

            I am wondering if I may have overcomplicated this in my initial design . . . nesting the "button states" movie clip within the movie clip that animates the button "fading in" to the scene . . . should I be taking an entirely different approach? Any tutorials/examples/suggestions out there?

            Also, if you have the time kglad, wanna give me an example of how to properly control those movieclip timelines from the actions layer?
            • 3. Re: Novice Navigation Woes
              kglad Adobe Community Professional & MVP
              i can't tell you too many specifics because you have incorrect references to your movieclips and/or buttons (or you wouldn't be posting here). you could take one of your movieclip buttons (and the movieclip it's supposed to control) and place the following on each of their timelines. if you post the results in the output panel (and tell me which output is from the movieclip button's timeline and which from the corresponding movieclip it's supposed to control) i can tell you how to code your buttons.