darksranger
20.10.2007, 13:11
у меня вопрос как написать\сделать скролер чтобы не зависимо от глубины текста или картинок в нем он не тормозил ?
проблема вобщем вот в чем нашел среди темпов скролер посматрел не тормазит положил текст длинный в него стал жутко тормозить проц под 99% начинает тормозить из лазил все настройки не чего не помогло привожу код скролера
// set up content_mc info
contentRight = _parent.content_mc._y;
contentLeft = 365-_parent.content_mc._height;
// 365-
// set up gutter info
gutterLeft = _parent.scrollbarGutter_mc._y-2;
gutterRight = ((_parent.scrollbarGutter_mc._y+_parent.scrollbarGutter_mc._height)-this._height)-1;
// don't use the hand icon
this.useHandCursor = false;
// handle press event
this.onPress = function() {
contentLeft = 120-_parent.content_mc._height;
this.startDrag(false, this._x, gutterLeft, this._x, gutterRight);
dragging = true;
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
this.onRelease = this.onReleaseOutside=function () { this.onMouseMove = undefined;this.stopDrag();dragging = false;ySpeed = (newypos-oldypos)*RATIO;};
// set initial variables
FRICTION = .92;
RATIO = .5;
dragging = false;
// handle onEnterFrame event
this.onEnterFrame = function() {
if (!dragging) {
oldypos = this._y;
newypos = oldypos+ySpeed;
ySpeed *= FRICTION;
if (newypos>gutterRight || newypos<gutterLeft) {
ySpeed *= -FRICTION;
newypos = oldypos;
}
this._y = newypos;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.content_mc._y)+0.0;
} else {
oldypos = newypos;
newypos = this._y;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.content_mc._y)+0.0;
}
};
PS если есть у кого то нормальный скролер кинте им в меня плз
проблема вобщем вот в чем нашел среди темпов скролер посматрел не тормазит положил текст длинный в него стал жутко тормозить проц под 99% начинает тормозить из лазил все настройки не чего не помогло привожу код скролера
// set up content_mc info
contentRight = _parent.content_mc._y;
contentLeft = 365-_parent.content_mc._height;
// 365-
// set up gutter info
gutterLeft = _parent.scrollbarGutter_mc._y-2;
gutterRight = ((_parent.scrollbarGutter_mc._y+_parent.scrollbarGutter_mc._height)-this._height)-1;
// don't use the hand icon
this.useHandCursor = false;
// handle press event
this.onPress = function() {
contentLeft = 120-_parent.content_mc._height;
this.startDrag(false, this._x, gutterLeft, this._x, gutterRight);
dragging = true;
this.onMouseMove = function() {
updateAfterEvent();
};
};
// handle release event
this.onRelease = this.onReleaseOutside=function () { this.onMouseMove = undefined;this.stopDrag();dragging = false;ySpeed = (newypos-oldypos)*RATIO;};
// set initial variables
FRICTION = .92;
RATIO = .5;
dragging = false;
// handle onEnterFrame event
this.onEnterFrame = function() {
if (!dragging) {
oldypos = this._y;
newypos = oldypos+ySpeed;
ySpeed *= FRICTION;
if (newypos>gutterRight || newypos<gutterLeft) {
ySpeed *= -FRICTION;
newypos = oldypos;
}
this._y = newypos;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.content_mc._y)+0.0;
} else {
oldypos = newypos;
newypos = this._y;
// always move content_mc whether dragging or not
var percent = (this._y-gutterLeft)/(gutterRight-gutterLeft);
this._parent.content_mc._y = percent*(contentLeft-contentRight)+contentRight;
this._parent.content_mc._y=int(this._parent.content_mc._y)+0.0;
}
};
PS если есть у кого то нормальный скролер кинте им в меня плз