5 Replies Latest reply on Mar 23, 2011 6:52 AM by Ned Murphy

    Adding extra script

    janineabc Level 1

      Hi I've recently followed a tutorial to make a scrolling thumbnail panel that goes up when you down and down when you go up. est. This has worked perfectly will the script below...However Im looking to make an alteration to this so that when you are not on "stoke" the "panel" stops moving. Its currently set to not move until you role over on to it originally, however after that when you are not on the panel it continues to move when you stroll across the rest of the page miles away from the panel.

       

      Here is the script which I have in it: Any assistance would be greatly appreciated. Thanks.

       

       

      panel.onRollOver = panelOver;

       

      function panelOver() {

      this.onEnterFrame = scrollPanel;

      delete this.onRollOver;

      }

       

      var b = stroke.getBounds (_root);

       

      function scrollPanel() {

      if(_xmouseb.xMax || _ymouseb.yMax) {

      this.onRollOver = panelOver;

      delete this.onEnterFrame;

      }

       

      if (panel._y >= -2.0) {

      panel._y = -2.0;

      }

      if (panel._y <= -242) {

      panel._y = -242;

      }

       

      var ydist = _ymouse- 110;

      panel._y += -ydist/15;

       

      }

        • 1. Re: Adding extra script
          Ned Murphy Adobe Community Professional & MVP

          See if changing your code to the following does what you want...

           

          panel.onRollOver = panelOver;

          function panelOver() {
              this.onEnterFrame = scrollPanel;
          }

           

          panel.onRollOut = panelOut;

          function panelOut() {
              delete this.onEnterFrame;
          }

           

          function scrollPanel() {
              if (panel._y >= -2.0) {
                 panel._y = -2.0;
              }
             
              if (panel._y <= -242) {
                 panel._y = -242;
              }
             
              var ydist = _ymouse- 110;
              panel._y += -ydist/15;
          }

          • 2. Re: Adding extra script
            janineabc Level 1

            Hi, thankyou this does the job perfectly, However by doing so its caused me a smaller issue. I can no longer get my buttons to load in the images.

             

            I had originally on the buttons in the panel.

             

            on (press) {

            _root.gotoAndStop("7")

            }

             

            I've also just attempted the below:

             

            on (release) {

            gotoAndStop("2");

             

            }

             

            However I carnt seem to make them load in.

             

            Its set up with just each image on a different frame.

             

            Thanks for your help.

            • 3. Re: Adding extra script
              Ned Murphy Adobe Community Professional & MVP

              Okay, scratch that approach... having the rollout on the panel blocks access to any buttons within it. Head back to what you had.  This line of code...

               

              if(_xmouseb.xMax || _ymouseb.yMax) {

               

              is the culprit that you need to resolve into detecting that the mouse is no longer over the panel.  I don't see those variables defined or calculated anywhere so I cannot guess what they represent beyond being indicators of exceeding the limits to one side of the panel.  If you cannot figure out what needs to be tweaked to make that work, what you might try in place of that line is...

               

               

              if(_xmouse < panel._x || _xmouse > panel._x+panel._width  || _ymouse < panel._y || _ymouse > panel._y+panel._height  ) {

              • 4. Re: Adding extra script
                janineabc Level 1

                Brilliant this works perfectly, buttons and all! Thanks alot for all your help, its much appreciated.

                 

                Thanks again

                • 5. Re: Adding extra script
                  Ned Murphy Adobe Community Professional & MVP

                  You're welcome