5 Replies Latest reply on Aug 5, 2009 9:12 AM by thehoustonbrothers

    flash tutorial gone wrong..

    thehoustonbrothers

      Hello

       

      I am trying to create a custom scrollbar for a website... I watched the tutorial>http://www.entheosweb.com/Flash/video_tutorials/custom_scroller.asp

      on how to create one. I have the scrollbar working but it won't attach to the text!

       

      Here is the actionscript:

       

      var scrollUpper:Number = 338.2;
      var scrollLower:Number = 498.2;

       

      var textLower:Number = 337.0;
      var textUpper:Number = 514;

       

      var scrollRange:Number = scrollLower - scrollUpper;
      var textRange:Number = textLower - textUpper;

       

      function scroll () {
          var moved:Number = scroller_mc._y - scrollUpper;
          var pctMover:Number = moved/scrollRange;
          var textMove:Number = pctMoved*textRange;
          text_mc_y = textLower - textMove;
      }

       

      scroller_mc.onPress = function () {
          this.startDrag (false,this._x,scrollUpper,this._x,scrollLower);
          this.onMouseMove = scroll;
      }

       

      scroller_mc.onRelease = scroller_mc.onReleaseOutside = function() {
          this.stopDrag ();
          this.onMouseMove = null;
      }

       

      I have the text in a mc called text_mc and the scrollbar in scroll_mc. There is a mask over the text.

       

      Thank you for your time!

       

      Virginia

        • 1. Re: flash tutorial gone wrong..
          kglad Adobe Community Professional & MVP

          you have a typo.  use:

           


           

          var scrollUpper:Number = 338.2;
          var scrollLower:Number = 498.2;

           

          var textLower:Number = 337.0;
          var textUpper:Number = 514;

           

          var scrollRange:Number = scrollLower - scrollUpper;
          var textRange:Number = textLower - textUpper;

           

          function scroll () {
              var moved:Number = scroller_mc._y - scrollUpper;
              var pctMover:Number = moved/scrollRange;
              var textMove:Number = pctMoved*textRange;
              text_mc._y = textLower - textMove;
          }

           

          scroller_mc.onPress = function () {
              this.startDrag (false,this._x,scrollUpper,this._x,scrollLower);
              this.onMouseMove = scroll;
          }

           

          scroller_mc.onRelease = scroller_mc.onReleaseOutside = function() {
              this.stopDrag ();
              this.onMouseMove = null;
          }


          1 person found this helpful
          • 2. Re: flash tutorial gone wrong..
            thehoustonbrothers Level 1

            I added the period but it still didn't work.. Here is my new as>

             

            var scrollUpper:Number = 338.2;
            var scrollLower:Number = 498.2;

             

            var textLower:Number = 337.0;
            var textUpper:Number = 514;

             

            var scrollRange:Number = scrollLower - scrollUpper;
            var textRange:Number = textLower - textUpper;

             

            function scroll () {
                var moved:Number = scroller_mc._y - scrollUpper;
                var pctMover:Number = moved/scrollRange;
                var textMove:Number = pctMoved*textRange;
                text_mc._y = textLower - textMove;
            }

             

            scroller_mc.onPress = function () {
                this.startDrag (false,this._x,scrollUpper,this._x,scrollLower);
                this.onMouseMove = scroll;
            }

             

            scroller_mc.onRelease = scroller_mc.onReleaseOutside = function() {
                this.stopDrag ();
                this.onMouseMove = null;
            }

             

            Any ideas? Thank you so much for your help!

             

            Virginia

            • 3. Re: flash tutorial gone wrong..
              kglad Adobe Community Professional & MVP

              you have a 2nd typo:

               


               

              var scrollUpper:Number = 338.2;
              var scrollLower:Number = 498.2;

               

              var textLower:Number = 337.0;
              var textUpper:Number = 514;

               

              var scrollRange:Number = scrollLower - scrollUpper;
              var textRange:Number = textLower - textUpper;

               

              function scroll () {
                  var moved:Number = scroller_mc._y - scrollUpper;
                  var pctMoved:Number = moved/scrollRange;
                  var textMove:Number = pctMoved*textRange;
                  text_mc._y = textLower - textMove;
              }

               

              scroller_mc.onPress = function () {
                  this.startDrag (false,this._x,scrollUpper,this._x,scrollLower);
                  this.onMouseMove = scroll;
              }

               

              scroller_mc.onRelease = scroller_mc.onReleaseOutside = function() {
                  this.stopDrag ();
                  this.onMouseMove = null;
              }

               

              Any ideas? Thank you so much for your help!

               

              Virginia

              1 person found this helpful
              • 4. Re: flash tutorial gone wrong..
                thehoustonbrothers Level 1

                Yeah!! Thank you ! I knew I needed a second pair of eyes for a minute.

                Thank you!

                 

                Virginia

                • 5. Re: flash tutorial gone wrong..
                  kglad Adobe Community Professional & MVP

                  you're welcome.