# How to get around this

**URL:** https://forum.kirupa.com/t/how-to-get-around-this/83977
**Category:** flash
**Created:** [March 23, 2005, 6:33pm UTC](https://forum.kirupa.com/t/how-to-get-around-this/83977 "2005-03-23T18:33:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rhamej](https://avatars.discourse-cdn.com/v4/letter/r/bb73d2/32.png) [@rhamej](https://forum.kirupa.com/u/rhamej)
#### Post date: [March 23, 2005, 6:33pm UTC](https://forum.kirupa.com/t/how-to-get-around-this/83977/1 "2005-03-23T18:33:13Z")

</div>

I am creating a scrollbar. That will scroll\_mc’s. The mc’s are dynamically created through XML that generate the buttons. (the mc’s are the buttons)  
Any way. Since the height of the scroller MC will be changing, I can’t stick a fixed height for how much the scroll buttons will scroll. The buttons are simple, an up and a down.  
Code here

```auto

maxUp = -(scroller._height-downButt._y);
trace(maxUp);
upButt.onPress = function() {
	scroller.onEnterFrame = function() {
		if (this._y == upButt._y) {
			delete this.onEnterFrame;
		} else {
			this._y += 5;
		}
	};
};
upButt.onRelease = function() {
	delete scroller.onEnterFrame;
};
//
downButt.onPress = function() {
	scroller.onEnterFrame = function() {
		if (this._y == maxUp) {
			delete this.onEnterFrame;
		} else {
			this._y -= 5;
			trace(this._y)
		}
	};
};
downButt.onRelease = function() {
	delete scroller.onEnterFrame;
};

```

maxUp returns a value of 266.

I have the scroll speed to scroll at 5 pixels. Since maxUp never hits 266, (since its incrementing at 5 pixels a time) the scroller never stops.

So tell me gurus. Other than taking out the calculator and coming up with speed number and a maxUp number that will always match. Whats the best way to to do this?  
Thanks,  
Josh
