# ScrollBar Mishaps

**URL:** <https://forum.kirupa.com/t/scrollbar-mishaps/106908>\
**Category:** Uncategorized\
**Created:** [April 10, 2004, 2:37am UTC](https://forum.kirupa.com/t/scrollbar-mishaps/106908 "2004-04-10T02:37:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elstrausso](https://avatars.discourse-cdn.com/v4/letter/e/97f17d/32.png) [@elstrausso](https://forum.kirupa.com/u/elstrausso)\
**Post date:** [April 10, 2004, 2:37am UTC](https://forum.kirupa.com/t/scrollbar-mishaps/106908/1 "2004-04-10T02:37:35Z")

</div>

I’m attempting to buld a scrollbar/image scroller like the one used in [http://thehulk.com/modern\_evo/index.html](http://thehulk.com/modern_evo/index.html)

I’ve been trying to get the ScrollHead on my MC (attached) to “slide to/and stop” at 4 different sections of the ScrollBar. I’ve had little success. I know there is someone out there that must have run into this before. I would appreciate any, and all, tips/advice on this. Thanks in advance for your help!  
-elstrausso

```auto
[SIZE=1][COLOR=blue]
 onClipEvent (enterFrame) {
	movie_width = 658;
	scroll_width = _root.content._width - movie_width;
	scrollbar_width = movie_width - _root.ScrollBar.ScrollHead._width;
	proportion = scroll_width/scrollbar_width;
	_root.content._x = proportion * _root.ScrollBar.ScrollHead._x * -1;
 }

```

[/SIZE] [/COLOR]  
and for my ScrollHead:

```auto
[SIZE=1][COLOR=blue]
this.ScrollHead.onPress = function() {
	ScrollHead.startDrag("",false, 0, 480, 0, 0);
}
this.ScrollHead.onRelease = this.ScrollHead.onReleaseOutside=function () {
	stopDrag();
}

```

[/SIZE] [/COLOR]

the following is my initial rough try at getting the ScrollHead to stop at (4) sections:

```auto
[SIZE=1][COLOR=blue]

if (_root.ScrollBar.ScrollHead._x < 210 ) {
ScrollHead._x = 50;
}else if{ (_root.ScrollBar.ScrollHead._x >50 ) {
ScrollHead._x = 50;
}else if{ (_root.ScrollBar.ScrollHead._x < 370) {
ScrollHead._x = 210;
}else if{ (_root.ScrollBar.ScrollHead._x >210 ) {
ScrollHead._x = 210;
}else if{ (_root.ScrollBar.ScrollHead._x < 530) {
ScrollHead._x = 530;
}else if{ (_root.ScrollBar.ScrollHead._x >370 ) {
ScrollHead._x = 530;
}else{(_root.ScrollBar.ScrollHead._x =0) 
}

```

[/SIZE] [/COLOR]
