5 Replies Latest reply on Mar 13, 2011 4:43 PM by Ned Murphy

    Vertical Sliding Content question

    kbanta11

      I'm trying to make vertical sliding content on my flash site and I have it working so that when I click on the second button, it slides up to the second content, but when I click back on the 1st, it doesn't slide back down to display the 1st content.  I'm using a mask slider, here's my code:

       

      var currentPosition:Number = contentholder.richginfo._y;

      var startFlag:Boolean = false;

      menuSlide = function (input:MovieClip) {

      if (startFlag == false) {

      startFlag = true;

      var finalDestination:Number = input._y;

      var distanceMoved:Number = 0;

      var distanceToMove:Number = Math.abs(finalDestination - currentPosition);

      var finalSpeed:Number = .3;

      var currentSpeed:Number = 0;

      var dir:Number = -1;

      if (currentPosition < finalDestination) {

      dir = -1;}

      else if (currentPosition >= finalDestination) {

      dir = 1;

      }

      this.onEnterFrame = function() {

      currentSpeed = Math.round((distanceToMove - distanceMoved + 1) * finalSpeed);

      distanceMoved += currentSpeed;

      contentholder._y += dir * currentSpeed;

      if (Math.abs(distanceMoved - distanceToMove) <= 1) {

      contentholder._y = maskMovie._y - currentPosition + dir * distanceToMove;

      currentPosition = input._y;

      startFlag = false;

      delete this.onEnterFrame;}};}

      };

      richgbutton.onRelease = function() {

      menuSlide(contentholder.richgphoto);

      };

      folsbutton.onRelease = function() {

      menuSlide(contentholder.folsinfo);

      };