17 Replies Latest reply on Jul 14, 2010 6:55 AM by Bruno Leonforte

    Scrolling to stop at the stage boundaries

    Bruno Leonforte

      Hey guys,


      I am trying to achieve this result.




      Its a really nice effect. Does anyone knows how to do it?



      I have this code:



      function accelScroller(myTarget) {


           myMiddle = Stage.width/2;


           this.onEnterFrame = function() {


           moveDist = myMiddle-_root._xmouse;


           myTarget._x += moveDist/20;






      I have a movie clip with all my images, this code allows me to go either right or left and decrease the speed either if i go to the right or left.

      But i want the the scrolling effect to stop when it reaches the end, either left or right side.


      How do i do that?


      you can download the fla file here