2 Replies Latest reply on Aug 7, 2007 8:19 AM by Newsgroup_User

    Smooth Animation Scroller (k)

    Level 7
      I have a movieClip that slowly moves across the screen using
      ActionScript. Problem is, when I want to speed up the scroll. It looks
      jumpy instead of smooth.

      Here is the ActionScript I am using for the movieClip:

      onClipEvent (enterFrame) {
      _x = _global.xValue;
      }

      Where:

      _global.xValue = _global.xValue-_global.speedValue;

      I have the _global.speedValue at 1, but want to increase it. If I change
      it to 3 it gets very jumpy since it is pushing the movieClip across the
      screen 3 pixels at a time.

      How can I get that speed without increasing the FPS, just using
      ActionScript?

      I also placed this in the beginning of the my scene:

      setProperty("", _highquality, "2");

      Any help would be appreciated.

      -Kirk
        • 1. Re: Smooth Animation Scroller (k)
          kglad Adobe Community Professional & MVP
          you can use setInterval() to increase the frequency of updating your movieclip's _x property. if you decrease its _x property more frequently (by a fixed amount) it will appear to move faster. if that fixed amount is small (like 1) it won't appear to "jump" from position to to position.
          • 2. Re: Smooth Animation Scroller (k)
            Level 7
            Not sure this will work in my current scenario. The movieClip that moves
            also loops. So when it hits a certain _x coordinate it goes back to the
            beginning and starts over. Overall, the movement is working well as long
            as I keep my move speed to 1. This moves the movieClip 1pixel each loop.

            The movieClip houses 10 FLVs. When rolled over, they stop the clip
            movement and play.

            I toyed a bit with the Tween class, but the results seemed even choppier.


            Here's a breakdown of the movement:
            -----------------------------------------------
            FRAME 1:

            _global.speedValue = 1;
            _global.pauseScroll = 0;
            _global.counter = 0;

            MOVIECLIP's ActionScript:

            onClipEvent (load) {
            _global.xValue = 0;
            _global.videoWidth = this._width;
            }
            -----------------------------------------------
            FRAME 2(labeled "Start"):
            MOVIECLIP's ActionScript:

            onClipEvent (enterFrame) {
            _x = _global.xValue;
            }
            -----------------------------------------------
            FRAME 3(labeled "Loop"):

            if (_global.pauseScroll == 0) {
            _global.xValue = _global.xValue-_global.speedValue;
            _global.counter = _global.counter+_global.speedValue
            }
            -----------------------------------------------
            FRAME 4:

            if (_global.counter>=2570) {
            _global.xValue = (2570+mcVideoBar._x)-_global.speedValue;
            //2570 is the width of the video movieClip bar, 3334, minus the
            width(764) of the
            //three duplicate clips(necessary for overlap)
            _global.counter = 0;
            gotoAndPlay("Start");
            } else {
            gotoAndPlay("Loop");
            }
            -----------------------------------------------


            kglad wrote:
            > you can use setInterval() to increase the frequency of updating your
            > movieclip's _x property. if you decrease its _x property more frequently (by a
            > fixed amount) it will appear to move faster. if that fixed amount is small
            > (like 1) it won't appear to "jump" from position to to position.
            >