Hello,
I got it working - massive thanks for taking the time to help. All hail roundProps as well!!!
I had to adapt your code a bit to fit what my layout was doing, but here it is in AS2 (thumbnails_holder is the strip of thumbnails, thumbnails_mask is the viewable area):
_root.ratio = 0;
_root.destinationX = _root.button_select._x;
_root._destinationX = _root.thumbnails_holder._x;
_root.maxSpeed = 15;
// Set the scrolling trigger areas to be a multiple of the number of columns, unless you have one column
if (_root.thumbnails_mask._width > 396) {
_root.activePixels = (198 * (Math.floor((_root.thumbnails_mask._width / 2) / 198)) - 25);
} else {
_root.activePixels = 50;
}
// Start scrolling the grid if needed
if (_root.thumbnails_holder._width > _root.thumbnails_mask._width) {
_root.onEnterFrame = function() {
_root.scrollGrid();
};
}
function scrollGrid() {
// If the mouse is inside the scrollable area:
if (_root._ymouse > _root.nav._y + _root.nav._height && _root._ymouse < _root.footer._y - _root.footer._height) {
var _leftEdge:Number = _root.thumbnails_mask._x;
var _rightEdge:Number = _root.thumbnails_mask._x + _root.thumbnails_mask._width;
var _maxScrollX:Number = _leftEdge;
var _minScrollX:Number = _rightEdge - _root.thumbnails_holder._width;
if (_root._xmouse < _leftEdge + _root.activePixels) {
// Scroll left
_root.ratio = ((_leftEdge + _root.activePixels) - _root._xmouse) / _root.activePixels;
_root.destinationX = _root._destinationX + _root.maxSpeed * _root.ratio;
if (_root.destinationX > _maxScrollX) {
_root.destinationX = _maxScrollX;
}
} else if (_root._xmouse > _rightEdge - _root.activePixels) {
// Scroll right
_root.ratio = 1 - ((_rightEdge - _root._xmouse) / _root.activePixels);
_root.destinationX = _root._destinationX - _root.maxSpeed * _root.ratio;
if (_root.destinationX < _minScrollX) {
_root.destinationX = _minScrollX;
}
}
if (_root.destinationX != _root._destinationX) {
_root._destinationX = _root.destinationX;
// Add a slower tween if you're about to hit either edge
if (_root.destinationX != _maxScrollX && _root.destinationX != _minScrollX) {
TweenMax.to(_root.thumbnails_holder,1,{_x:_root.destinationX, ease:Strong.easeOut, roundProps:["_x"]});
} else {
TweenMax.to(_root.thumbnails_holder,1.5,{_x:_root.destinationX, ease:Strong.easeOut, roundProps:["_x"]});
}
}
}
}