HN4E7O
01.07.2006, 15:22
Простите за offtop но не нашёл ничего в поиске... уверен что это есть готовое...
Имею скролл который работает.... всё чудестно... но размер "бегунка" scrollBarra.botton._height=222 ставлю тупо в пикселях... и не могу придумать алгоритм чтобы "бегунок" уменьшался в зависисости от размера поля this.newsMc.textMc._height....
вот код scroll:
if (this.newsMc.textMc._height>this.newsMc.newsMask._height) mixScroll();
function mixScroll() {
this.createEmptyMovieClip ("scrollBarra", 3);
scrollBarra.attachMovie ("botton", "botton", 2);
scrollBarra._x =this.newsMc.textMc._x;
scrollBarra._y = this.newsMc._y;
scrollBarra.botton._height =222;
desplazamiento = this.newsMc.newsMask._height; // height MAscara
mScroll = (this.newsMc.textMc._height/desplazamiento)-1;
mMaxScroll = this.newsMc.textMc._height-desplazamiento;
velocidad = 5
izquierda = scrollBarra.botton._x;
superior = this.newsMc.textMc._y;
derecha = scrollBarra.botton._x;
inferior = desplazamiento-scrollBarra.botton._height;
ancho = this.newsMc.textMc._width+15;
scrollBarra.botton.onPress = function() {
startDrag(this, false, izquierda, superior, derecha, inferior);
};
scrollBarra.botton.onRelease = scrollBarra.botton.onReleaseOutside=function () {
stopDrag();
};
this.onEnterFrame = function() {
posicion = Math.round((superior - scrollBarra.botton._y - scrollBarra.botton._height * (scrollBarra.botton._y / (desplazamiento - scrollBarra.botton._height))) * mScroll);
if (this.newsMc.textMc._y<mMaxScroll+desplazamiento) {
this.newsMc.textMc._y = (posicion+velocidad*this.newsMc.textMc._y)/(velocidad+1);
}
}
}
Имею скролл который работает.... всё чудестно... но размер "бегунка" scrollBarra.botton._height=222 ставлю тупо в пикселях... и не могу придумать алгоритм чтобы "бегунок" уменьшался в зависисости от размера поля this.newsMc.textMc._height....
вот код scroll:
if (this.newsMc.textMc._height>this.newsMc.newsMask._height) mixScroll();
function mixScroll() {
this.createEmptyMovieClip ("scrollBarra", 3);
scrollBarra.attachMovie ("botton", "botton", 2);
scrollBarra._x =this.newsMc.textMc._x;
scrollBarra._y = this.newsMc._y;
scrollBarra.botton._height =222;
desplazamiento = this.newsMc.newsMask._height; // height MAscara
mScroll = (this.newsMc.textMc._height/desplazamiento)-1;
mMaxScroll = this.newsMc.textMc._height-desplazamiento;
velocidad = 5
izquierda = scrollBarra.botton._x;
superior = this.newsMc.textMc._y;
derecha = scrollBarra.botton._x;
inferior = desplazamiento-scrollBarra.botton._height;
ancho = this.newsMc.textMc._width+15;
scrollBarra.botton.onPress = function() {
startDrag(this, false, izquierda, superior, derecha, inferior);
};
scrollBarra.botton.onRelease = scrollBarra.botton.onReleaseOutside=function () {
stopDrag();
};
this.onEnterFrame = function() {
posicion = Math.round((superior - scrollBarra.botton._y - scrollBarra.botton._height * (scrollBarra.botton._y / (desplazamiento - scrollBarra.botton._height))) * mScroll);
if (this.newsMc.textMc._y<mMaxScroll+desplazamiento) {
this.newsMc.textMc._y = (posicion+velocidad*this.newsMc.textMc._y)/(velocidad+1);
}
}
}