7 Replies Latest reply on Aug 3, 2008 1:58 PM by kglad

    scrolling a really wide picture (timeline)

    Sunnyspring
      I am making a timeline. I have made it really long, the scene is in the middle, and I want to be able to scroll the timeline both directions, left and right. I have made to buttons, and have made a code that functions. But I believe I need a test that stops the process whenever the user release (let go of) the button. Now it seems like the process is working even when the button is released. It works fine when the user comes to the end of the timeline, then the process stops. But if the user let go of the button in the middle of the timeline, the process is running anyway.
      Here is the code ("frem" means forward, "tilbake" means backwards):

      stop();

      Frem_btn.onPress = function() {
      speed = 3;
      _root.Tallinjen_mc.onEnterFrame = function() {
      trace ("this._x er: " + this._x);
      if (this._x > -2180) {
      this._x -= _root.speed;
      }
      else if (this._x < -2180){
      stop();
      }
      Frem_btn.onRelease = function() {
      _root.speed = 0;
      }
      }
      }

      Tilbake_btn.onPress = function() {
      speed = 3;
      _root.Tallinjen_mc.onEnterFrame = function() {
      if (this._x > -2180 && this._x < 3499) {
      this._x += _root.speed;
      Tilbake_btn.onRelease = function() {
      _root.speed = 0;
      stop();
      }
      }
      else if (this._x > 3500){
      stop();
      }
      Tilbake_btn.onRelease = function() {
      _root.speed = 0;
      stop();
      }
      }
      }