5 Replies Latest reply on Jan 21, 2007 11:21 AM by kglad

    Scroll Bar actionScript 

    BigdaddyVELTRI
      For some reason the following scroll bar actionScript does not work when published as actionScript 2.0. I really need it as 2.0 player 8.
      Can someone take a look at the link below? Thanks.
      http://www.ctvdesigns.com/scrollbar.zip
        • 1. Re: Scroll Bar actionScript 
          kglad Adobe Community Professional & MVP
          usually that's due to an inconsistant object name (myvar in flash 5 was the same as myVar) or failure to initialize a numeric variable (which was the same as the variable being 0 but is now NaN).
          • 2. Re: Scroll Bar actionScript 
            BigdaddyVELTRI Level 1
            Actually, I'm getting the following errors. I tried changing 0 to NaN. Didn't work. Any other ideas? Thanks for your help!.

            **Error** Symbol=scroll down button, layer=Layer 1, frame=1:Line 3: Unexpected '.' encountered
            ../:loopEnabled = 0;

            **Error** Symbol=scroll down button, layer=Layer 1, frame=1:Line 4: Statement must appear within on handler
            tellTarget ("../") {

            **Error** Symbol=scroll down button, layer=Layer 1, frame=1:Line 7: Unexpected '}' encountered
            }

            **Error** Symbol=scroll up button, layer=Layer 1, frame=1:Line 3: Unexpected '.' encountered
            ../:loopEnabled = 0;

            **Error** Symbol=scroll up button, layer=Layer 1, frame=1:Line 4: Statement must appear within on handler
            tellTarget ("../") {

            **Error** Symbol=scroll up button, layer=Layer 1, frame=1:Line 7: Unexpected '}' encountered
            }

            **Error** Symbol=clip scroll knob, layer=Layer 1, frame=1:Line 2: Operator '+' must be followed by an operand
            startDrag("", false, getProperty("", _x), Number(getProperty("../scroll_track", _y))+Number(../:scrollTrackPadding), getProperty("", _x), Number(Number(getProperty("../scroll_track", _y))+Number(../:scrollTrackPadding))+Number(../:travelLength));

            **Error** Symbol=clip scroll knob, layer=Layer 1, frame=1:Line 3: ')' or ',' expected
            tellTarget ("../") {

            **Error** Symbol=clip scroll knob, layer=Layer 1, frame=1:Line 6: Unexpected '}' encountered
            }

            Total ActionScript Errors: 9 Reported Errors: 9
            • 3. Re: Scroll Bar actionScript 
              kglad Adobe Community Professional & MVP
              don't change a zero to NaN in the script. i was pointing out that an undefined numeric variable in older versions of actionscript was understood to have a value of zero.

              so, you could, for example, add one that undefined variable and it would have a value of one. with the current version of flash if you add one to an undefined variable it is NaN (or Not a Number).

              as for those errors, well that code is a mess. i started to correct that code and saw some other "issues". for example, the author of that code used maxScroll which is incorrect. that should be maxscroll and is one of the two major problems i mentioned above.
              • 4. Re: Scroll Bar actionScript 
                BigdaddyVELTRI Level 1
                I got it to work!

                I just changed this:
                ../:scrollTrackPadding
                to this:
                this._parent.scrollTrackPadding

                and

                this:
                ../:loopEnabled = 0;
                to this
                loopEnabled = 0;

                Thanks for your help.
                • 5. Re: Scroll Bar actionScript 
                  kglad Adobe Community Professional & MVP
                  you're welcome