0 Replies Latest reply on Oct 29, 2010 3:53 AM by T. Backx

    X-postition slide wrong?

    T. Backx

      Hello all,

       

      I've a new problem with the slider I was making. First it was the timer BUT thanks to kglad that is solved.

       

      But now the movieclips/ images don't loop as nice as the should. And this is keep getting worse.

      Here is a sreenshot of the problem I have so that you can see what I mean.

      slider2.jpgslider1.jpg

       

      See? The left corner!

      So I looked at the ASframe and maybe the problem relies on this:

      var finalSpeed = 3.000000E-001;

       

      But like it says: It's only the speed of the slider. Also if it's the X-position of the registration point. I already changed it to the leftuppercorner instead of the center like it was before.

       

      I hope someone can put me in the rigth direction.

       

      Here is my full AS as it is now:

       

      slides = 7;
      playclip._visible = false

      contentHold.content1.button.onPress = function() {
      getURL("
      www.visualbrand.nl/kijken.html", "_self");
      };
      contentHold.content2.button.onPress = function() {
      getURL("
      http://www.bestsellers.nl/catalog/category/view/id/249", "_self");
      };
      contentHold.content3.button.onPress = function() {
      getURL("
      http://www.bestsellers.nl/music/8718036994508.html", "_self");
      };
      contentHold.content4.button.onPress = function() {
      getURL("
      http://http://www.bestsellers.nl/5099990631825.html", "_self");
      };
      contentHold.content5.button.onPress = function() {
      getURL("
      http://www.bestsellers.nl/catalog/category/view/id/270", "_self");
      };
      contentHold.content6.button.onPress = function() {
      getURL("
      http://www.visualbrand.nl", "_self");
      };
      var currentPosition = contentHold.content1._x;
      var startFlag = false;
      menuSlide = function (input) {
      if (startFlag == false) {
        startFlag = true;
        var _loc1 = input._x;
        var distanceMoved = 0;
        var distanceToMove = Math.abs(_loc1-currentPosition);
        var finalSpeed = 3.000000E-001;
        var currentSpeed = 0;
        var dir = 1;

        if (currentPosition<=_loc1) {
         dir = -1;
        } else if (currentPosition>_loc1) {
         dir = 1;
        }
        // end else if
        contentHold.onEnterFrame = function() {
         currentSpeed = Math.round((distanceToMove-distanceMoved+1)*finalSpeed);
         distanceMoved = distanceMoved+currentSpeed;
         contentHold._x = contentHold._x+dir*currentSpeed;
         if (Math.abs(distanceMoved-distanceToMove)<=1) {
          contentHold._x = maskMovie._x-currentPosition+dir*distanceToMove;
          currentPosition = input._x;
          startFlag = false;
          delete contentHold.onEnterFrame;
         }
         // end if
        };
      }
      // end if
      };
      bAll.mov1.b1.onRelease = function() {
      menuSlide(contentHold.content1);
      bAll.mov1.gotoAndPlay(1);
      bAll.mov2.gotoAndPlay(1);
      bAll.mov3.gotoAndPlay(1);
      bAll.mov4.gotoAndPlay(1);
      bAll.mov5.gotoAndPlay(1);
      bAll.mov6.gotoAndPlay(1);
      bAll.mov7.gotoAndPlay(1);
      };
      bAll.mov2.b2.onRelease = function() {
      menuSlide(contentHold.content2);
      bAll.mov1.gotoAndPlay(175);
      bAll.mov2.gotoAndPlay(175);
      bAll.mov3.gotoAndPlay(175);
      bAll.mov4.gotoAndPlay(175);
      bAll.mov5.gotoAndPlay(175);
      bAll.mov6.gotoAndPlay(175);
      bAll.mov7.gotoAndPlay(175);
      };
      bAll.mov3.b3.onRelease = function() {
      menuSlide(contentHold.content3);
      bAll.mov1.gotoAndPlay(350);
      bAll.mov2.gotoAndPlay(350);
      bAll.mov3.gotoAndPlay(350);
      bAll.mov4.gotoAndPlay(350);
      bAll.mov5.gotoAndPlay(350);
      bAll.mov6.gotoAndPlay(350);
      bAll.mov7.gotoAndPlay(350);
      };
      bAll.mov4.b4.onRelease = function() {
      menuSlide(contentHold.content4);
      bAll.mov1.gotoAndPlay(525);
      bAll.mov2.gotoAndPlay(525);
      bAll.mov3.gotoAndPlay(525);
      bAll.mov4.gotoAndPlay(525);
      bAll.mov5.gotoAndPlay(525);
      bAll.mov6.gotoAndPlay(525);
      bAll.mov7.gotoAndPlay(525);
      };
      bAll.mov5.b5.onRelease = function() {
      menuSlide(contentHold.content5);
      bAll.mov1.gotoAndPlay(700);
      bAll.mov2.gotoAndPlay(700);
      bAll.mov3.gotoAndPlay(700);
      bAll.mov4.gotoAndPlay(700);
      bAll.mov5.gotoAndPlay(700);
      bAll.mov6.gotoAndPlay(700);
      bAll.mov7.gotoAndPlay(700);
      };
      bAll.mov6.b6.onRelease = function() {
      menuSlide(contentHold.content6);
      bAll.mov1.gotoAndPlay(875);
      bAll.mov2.gotoAndPlay(875);
      bAll.mov3.gotoAndPlay(875);
      bAll.mov4.gotoAndPlay(875);
      bAll.mov5.gotoAndPlay(875);
      bAll.mov6.gotoAndPlay(875);
      bAll.mov7.gotoAndPlay(875);
      };
      bAll.mov7.b7.onRelease = function() {
      menuSlide(contentHold.content7);
      bAll.mov1.gotoAndPlay(1050);
      bAll.mov2.gotoAndPlay(1050);
      bAll.mov3.gotoAndPlay(1050);
      bAll.mov4.gotoAndPlay(1050);
      bAll.mov5.gotoAndPlay(1050);
      bAll.mov6.gotoAndPlay(1050);
      bAll.mov7.gotoAndPlay(1050);
      };

      var autoAdvanceI:Number = setInterval(autoAdvanceF,7000);
      var count:Number = 0;

      playclip.onRelease = function () {
      delay.play();
      pauze._visible = true;
      playclip._visible = false;
      gotoAndPlay("playy");

      clearInterval(autoAdvanceI);
      //  start a loop that calls autoAdvanceF() every 7000 ms = 7 seconds
      var autoAdvanceI:Number = setInterval(autoAdvanceF,7000);
      // my count variable ranges from 0 to slides-1
      var count:Number = 0;
      };

      pauze.onRelease = function () {
      delay.pause();
      playclip._visible = true;
      pauze._visible = false;
      clearInterval(autoAdvanceI);
      };

      function autoAdvanceF():Void{
      // increment count and reset count if incremented to slides
      count = (count+1)%slides;
      // pass contentHold["content"+(count+1)] to menuSlide()
      menuSlide(contentHold["content"+(count+1)]);
      };

       

      Thank you in Advance!

       

      Tim