3 Replies Latest reply on Jun 20, 2007 8:53 AM by cre8ive1974

    .hitTest

    cre8ive1974
      can some tell me why this code does not work?

      When I rollover my_btn, my_MC only advances one frame then stops, the MC is 15 frames in length, When I rollback over again it again advances one more frame. When I rollout, it does not go to the prev frame.

      any ideas?
      Thanks
      D


      my_btn.onRollOver = function(){
      if (this.hitTest(_root.my_btn) == true) {
      my_MC.nextFrame();
      } else {
      my_MC.prevFrame();

      }

      }
        • 1. Re: .hitTest
          Greg Dove Level 4
          onRollOver occurs once when you move the mouse over the button

          when it does.... it seems that you're checking to see if my_btn occupies the same space on screen as my_btn (so this will return always be true) and therefore my_MC will advance one frame.
          • 2. Re: .hitTest
            Greg Dove Level 4
            Is this the kind of thing you're trying to do? [just typed it didn't test it]

            my_btn.onRollOver = function(){
            my_MC.onEnterFrame = function() {
            if (my_MC._currentframe<my_MC._totalframes) {
            my_MC.nextFrame()
            } else delete my_MC.onEnterFrame;


            }
            }

            my_btn.onRollOut = function(){
            my_MC.onEnterFrame = function() {
            if (my_MC._currentframe>1) {
            my_MC.prevFrame();
            } else delete my_MC.onEnterFrame;

            }
            }

            • 3. Re: .hitTest
              cre8ive1974 Level 1
              thanks for your reply. The following code is what I'm looking for. The onEnterFrame was what I was looking for.

              my_Btn.onEnterFrame = function(){
              if (my_Btn.hitTest(_root._xmouse, _root._ymouse, true) == true) {
              my_MC.nextFrame();
              } else {
              my_MC.prevFrame();
              }

              thanks for your help!
              D