…In flash 8
So i have a nice scrolling thing going on and i can’t make it stay where i want it.
the scrollbar moves to _x = 0, when i want it to stop at about _x = 120 and the scrolled clip moves too far left too!
For one, the confines of the scrollbutton, set within startDrag seem to be ignored…???
stumped.
onClipEvent (enterFrame) {
//_root.scrollgroov.useHandCursor = _root.scrollbar.useHandCursor=true;
_root.scrollbar.useHandCursor =true;
//space = 16;
friction = 0.9;
speed = 6;
x = -(_root.scrollbar._x);
//left = 240;
left = _root.scrolling_mc._x;
right = _root.scrolling_mc._x+_root.mask._width-_root.scrolling_mc._width-space;
//right = _root.mask._x+_root.mask._width;
_root.scrollbar.onPress = function() {
drag = true;
_root.scrollbar.startDrag(_root.scrollbar._x,true, 13,883,13,120);// top,right,bot,left?
_root.scrollbar.scrollEase();
};
_root.scrollbar.onMouseUp = function() {
//drag = false;
this.stopDrag();
};
/*
movescrollbar = function (d) {
if ((_root.scrollbar._x>=x+_root.scrollgroov._width-(_root.scrollbar._width) && d == 1/2) || (_root.scrollbar._x<=x && d == -1)) {
clearInterval(myInterval);
} else {
_root.scrollbar._x += d;
_root.scrollbar.scrollEase();
updateAfterEvent();
}
};*/
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(x) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (_root.scrolling_mc._x-(x))/(_root.scrollgroov._width-this._width);
dx = Math.round((((left-(left-right)*r)-_root.scrolling_mc._x)/speed)*friction);
_root.scrolling_mc._x += dx;
};
};
}
The number of images is drawn from text file, (named picsno.txt), currently reading “NumberOfImages=16”, (but to be variable), and the images are in a folder named “images” (!)
I have to admit to being a bit of a luddite when it comes to the complex code used, still… no amount of fiddling is making things work as i want them too.
any help very welcome.
many thanks in advance.
apologies, i posted this in the wrong place a while ago!