0 Replies Latest reply on Feb 3, 2007 11:49 AM by

    Using slider to control movement

      Hi all, I would really appreciate some help figuring this problem out. I'm trying to build a scrubber to control the movement of some movieclips. My code now uses the up and down keys in an onEnterFrame to increase or decrease "vz". This is working fine, and my movieclips move using: dream.z += vz; This is the line of code I need help with to make my scrubber work. Does this make any sense? I posted this once, but I've tried to strip the code down to make it easier to read in the forum. The scrubber should zoom the dream clips in when you slide it all the way to the right, and the zoom the dream clips out to the original position when you slide it back to the left.


      ................//mover function
      function mover():Void {
      if (zdepth < 55 && Key.isDown(Key.UP)){
      vz -= .5;
      zdepth += .5;
      }
      if(zdepth > 0 && Key.isDown(Key.DOWN))
      {
      vz += .5;
      zdepth -= .5;
      }
      vz *= friction;
      for (var i:Number=0;i<dreamarray.length;i++) {
      var dream:MovieClip = home["dreamarray" +i];
      //this next line is what i need help with
      dream.z += vz;
      var scale:Number = fl / (fl + dream.z);
      dream.swapDepths(-dream.z);
      }
      }
      }

      .......................//scrubber code...................

      var scrubber:MovieClip;
      var track:MovieClip;

      scrubber.onPress = function(){
      this.startDrag(false,0,this._y,track._x + track._width,this._y);
      this.onEnterFrame = function(){
      trace(this._x);
      _parent.vz = -(16*this._x) / 300;
      }
      }

      scrubber.onRelease = function(){
      this.stopDrag();
      delete scrubber.onEnterFrame;
      }

      scrubber.onReleaseOutside = function(){
      this.stopDrag();
      delete scrubber.onEnterFrame;
      }