# Scroller with easing

**URL:** <https://forum.kirupa.com/t/scroller-with-easing/256151>\
**Category:** Uncategorized\
**Created:** [March 31, 2008, 11:34am UTC](https://forum.kirupa.com/t/scroller-with-easing/256151 "2008-03-31T11:34:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wampiro\_UHA](https://avatars.discourse-cdn.com/v4/letter/w/eb9ed0/32.png) [@Wampiro\_UHA](https://forum.kirupa.com/u/Wampiro_UHA)\
**Post date:** [March 31, 2008, 11:34am UTC](https://forum.kirupa.com/t/scroller-with-easing/256151/1 "2008-03-31T11:34:51Z")

</div>

I’ve tried to create a scroller from some ActionScript.  
The Scroller moves fine, but the Content doesn’t move at all.  
But it doesn’t work (AS2/Flash Player 8):

space = 20;  
friction = 0.9;  
speed = 4;  
y = Scroller.\_y;  
top = Content.\_y;  
bottom = Content.\_y+Mask.\_height-Content.\_height-space;  
Scroller.onPress = function() {  
drag = true;  
this.startDrag(false,this.\_x,this.\_parent.y,this.\_x,this.\_parent.y+this.\_parent.Mask.\_height-this.\_height);  
scrollEase();  
};  
Scroller.onMouseUp = function() {  
this.stopDrag();  
drag = false;  
};  
scrollEase = function () {  
this.onEnterFrame = function() {  
if (Math.abs(dy) == 0 && drag == false) {  
delete this.onEnterFrame;  
}  
r = (this.\_y-y)/(Mask.\_height-this.\_height);  
dy = Math.round((((top-(top-bottom)\*r)-Content.y)/speed)\*friction);  
Content.y += dy;  
};  
};

Anyone that can spot the problem?
