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
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