# Adding deceleration to scroller

**URL:** https://forum.kirupa.com/t/adding-deceleration-to-scroller/181902
**Category:** flash
**Created:** [March 14, 2006, 3:36am UTC](https://forum.kirupa.com/t/adding-deceleration-to-scroller/181902 "2006-03-14T03:36:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![OuttaMyZone](https://avatars.discourse-cdn.com/v4/letter/o/dec6dc/32.png) [@OuttaMyZone](https://forum.kirupa.com/u/OuttaMyZone)
#### Post date: [March 14, 2006, 3:36am UTC](https://forum.kirupa.com/t/adding-deceleration-to-scroller/181902/1 "2006-03-14T03:36:51Z")

</div>

I’m using the thumbnail gallery tutorial from this site, and I was wondering how I could add deceleration to the horizontal scroller. Here is the scroller part of the code from the flash file:

```php
function thumbNailScroller() {
// thumbnail code! 
this.createEmptyMovieClip("tscroller", 1000);
scroll_speed = 40;
tscroller.onEnterFrame = function() {
if ((_root._ymouse>=thumbnail_mc._y) && (_root._ymouse<=thumbnail_mc._y+thumbnail_mc._height)) {
if ((_root._xmouse>=(hit_right._x-40)) && (thumbnail_mc.hitTest(hit_right))) {
thumbnail_mc._x -= scroll_speed;
} else if ((_root._xmouse<=(hit_left._x+40)) && (thumbnail_mc.hitTest(hit_left))) {
thumbnail_mc._x += scroll_speed;
}
} else {
delete tscroller.onEnterFrame;
}
};
}

```
