7 Replies Latest reply on Oct 5, 2007 8:25 AM by adamon

    buttons within buttons issue

    adamon Level 1
      I have an issue that is driving me crazy.

      I have a movie button called "who we are" with rollovers, etc. This is located in scene one(root scene for the file). Within that button is another button (also a movie) called "mission" with rollovers etc.
      I am in AS 2.0 (thought it would be easier).

      The problem is: When I mouse over the "who we are " button the graphic slide out to display the "mission" button. When I mouse over the mission button the animation does not work. I tested the mission button outside of the who we are button and it works fine.

      Here is the script I am using on the main scene timeline (root):

      stop();

      //Test Button begins

      this.who_Btn.onRollOver = function() {
      who_Btn.gotoAndPlay("_over");
      }
      this.who_Btn.onRollOut = function() {
      who_Btn.gotoAndPlay("_out");
      }
      this.who_Btn.onPress = function() {
      who_Btn.gotoAndPlay("_down");
      }
      this.who_Btn.onRelease = function() {
      gotoAndPlay("us");
      }


      /* mission Button begins

      _root.who_Btn.mission_Btn.onRollOver = function() {
      who_Btn.mission_Btn.gotoAndPlay("_over");
      }
      _root.who_Btn.mission_Btn.onRollOut = function() {
      who_Btn.mission_Btn.gotoAndPlay("_up");
      }
      _root.who_Btn.mission_Btn.onPress = function() {
      who_Btn.mission_Btn.gotoAndPlay("_down");
      }
      _root.who_Btn.mission_Btn.onRelease = function() {
      gotoAndPlay("us");
      */



      //mission Button begins

      _root.who_Btn.mission_Btn.onRollOver = function() {
      mission_Btn.gotoAndPlay("_over");
      }
      _root.who_Btn.mission_Btn.onRollOut = function() {
      mission_Btn.gotoAndPlay("_up");
      }
      _root.who_Btn.mission_Btn.onPress = function() {
      mission_Btn.gotoAndPlay("_down");
      }
      _root.who_Btn.mission_Btn.onRelease = function() {
      gotoAndPlay("us");
      }


      //mission test Button begins

      _root.mission2_Btn.onRollOver = function() {
      mission2_Btn.gotoAndPlay("_over");
      }
      _root.mission2_Btn.onRollOut = function() {
      mission2_Btn.gotoAndPlay("_up");
      }
      _root.mission2_Btn.onPress = function() {
      mission2_Btn.gotoAndPlay("_down");
      }
      _root.mission2_Btn.onRelease = function() {
      gotoAndPlay("us");
      }

      I tried the mission button two ways commenting out each to test.

      Thanks in advance for any help with this.

      Regards,
      Robert


        • 1. Re: buttons within buttons issue
          C-Rock Level 2
          Ahhh my friend you can't do nested rollovers in as 2.0.

          A way around it that I always used was to use movieclips. Create your base button as a movie clip with 10 frames. The first 5 the closed state and the next five the open other buttons state, like a submenu. Stop commands and labels at the beginning and end. When you rollover the main button you placed inside this movieclip with 2 states, we'll call it buttonA, it goes and plays the second half of the movieclip "over" we'll call it.

          Then your other buttons that just appeared in the over state can have actions as well.

          To get back to the "out" "up" state of button A, you'll have a movie clip in the background that takes up the whole stage. Place it on the lowest layer and call it something like "rollout_mc" for the instance name. Now give it actions saying that onRollOver the your movie clip to go back to the beginning of the frames where the other buttons are hidden.

          Now the only problem is your rollout_mc will capture you rolling over it before you get to your other buttons. So place another movieclip over the rollout_mc and call it something like submenuBackground_mc. This will just block the rollout_mc from working in the area where the user would drag their mouse.

          Make sure you're rollout_mc is only in the second half of your movie, the "over" state.

          This is how I was taught to replicate nested rollovers, because they are not available in AS 2.0.

          If you have any qestions feel free to contact me.

          C
          • 2. Re: buttons within buttons issue
            adamon Level 1
            Thanks for the quick response.

            I think I kind of understand. The buttons are set up as movieclips.

            Is it possible to do the nested rollovers in AS3.0 or would I run into the same issue?

            Rob
            • 3. Re: buttons within buttons issue
              Damon Edwards Level 3
              if the MovieClip that is at the higher depth has events attached to it, it will capture all the events, and anything nested in it, will not be able to have any events... However, you can use a hitTest() to bypass that.
              • 4. Re: buttons within buttons issue
                adamon Level 1
                Thanks.

                If I use the hitTest() will I be able to see the nested rollover?

                What exactly is a hitTest

                Rob
                • 5. Re: buttons within buttons issue
                  Damon Edwards Level 3
                  If you use the hitTest, your nested clips will be able to receive events. Look it up in the Flash Help docs, or google it.
                  • 6. Re: buttons within buttons issue
                    C-Rock Level 2
                    or use AS 3.0, I think it does do nested rollovers, but I haven't tried it yet.
                    • 7. Re: buttons within buttons issue
                      adamon Level 1
                      OK. Thanks for all the help.

                      Regards,
                      Rob