2 Replies Latest reply on Mar 30, 2011 10:15 AM by rberardi

    clickable button (or MC) inside of a MC

    rberardi

      what i am trying to achieve:
      i need to create a navigation MC that, when rolled over, opens up to reveal a few buttons. (and when rolled off closes the navigation MC - basically a "play backwards" MC)

       

      i have been using the code below to make MC's "play backwards" for a long time without problem:

       

      _root.mainClip.rollOver01.onRollOver = function() {
          playMC1("for");
      };
      _root.mainClip.rollOver01.onRollOut = function() {
          playMC1("back");
      };

       

      function playMC1(dir) {
          switch (dir) {
              case "for" :
                  _root.mainClip.rollOver01.onEnterFrame = function() {
                      if (_root.mainClip.rollOver01._currentframe<10) {
                          _root.mainClip.rollOver01.gotoAndStop(_root.mainClip.rollOver01._currentframe+1);
                      } else {
                          delete this.onEnterFrame;
                      }
                  };
                  break;
              case "back" :
                  _root.mainClip.rollOver01.onEnterFrame = function() {
                      if (_root.mainClip.rollOver01._currentframe>1) {
                          _root.mainClip.rollOver01.gotoAndStop(_root.mainClip.rollOver01._currentframe-1);
                      } else {
                          delete this.onEnterFrame;
                      }
                  };
                  break;
          }
      }

       

      problem one: if i put a button or MC inside of rollOver01 - the button won't work. i need to have some clickable buttons or other MC's inside of the rollOver01 MC.

       

      problem two: with the above code, it gets pretty long  if i have 8 or 10 MC's that i want to play backwards. how can i shorten this code, for multiple MC's that i want to play backwards.

       

      thank you so much for any help!