
Код AS1/AS2:
class com.AlexNavigation.scrollbarDEFENDER {
var _S:MovieClip;//scroller
var _M:MovieClip;//mask
var _C:MovieClip;//content
var _d;
var _u;
var top;
var bottom;
var left;
var right;
var _int;
var _int2;
public function scrollbarDEFENDER() {
}
private function scrollIt(_s, _m, _c, useButtons, btDown, btUp) {
if (useButtons == undefined) {
useButtons = false;
}
_S = _s;
_M = _m;
_C = _c;
_d = btDown;
_u = btUp;
top = _M._y;
bottom = _M._y+_M._height-_S._height;
left = _M._x;
right = _M._x+_M._width;
_C._y = top;
_C._x = left;
_S._y = top;
_S._x = right;
_S.onPress = mx.utils.Delegate.create(this, PRESS);
_S.onMouseMove = mx.utils.Delegate.create(this, Update);
_S.onRelease = _S.onReleaseOutside=btDown.onRelease=btUp.onRelease=btDown.onReleaseOutside=btUp.onReleaseOutside=mx.utils.Delegate.create(this, RELEASE);
_M.onMouseMove = mx.utils.Delegate.create(this, check);
if (useButtons) {
_S._visible = false;
//btDown.onPress = mx.utils.Delegate.create(this, dREL);
//btUp.onPress = mx.utils.Delegate.create(this, upREL);
}
}
function RELEASE() {
clearInterval(_int);
_S.stopDrag();
}
function Update() {
var ratio = (_C._height-_M._height)/(_M._height-_S._height);
_C._y = ((_M._y-_S._y)*ratio)+_M._y;
}
function PRESS() {
if (_M._height<_C._height) {
_S.startDrag(false,right,top,right,bottom);
}
}
function check() {
if (_M._height<_C._height) {
_S.enabled = true;
_d._visible = true;
_u._visible = true;
} else {
_S.enabled = false;
_d._visible = false;
_u._visible = false;
}
}
}
к onMouseWheel сами прикрепите