Okay I have a custom scrollbar componnent (which I am creating) the only problem is that it is not working to get the scroll to the proportions (scroll to content height) and either wastes some of the space or adds some additional space to the end of the content…
Here is my init AS for the scrollbar:
function init_this(){
this.distortSize = 3;
this.adjScrollSize = this.scroller.top._height*2;
this.mHeight = this.attachBG._height;
this.scroller.spacer._height = ((this.mHeight)/this.attachTo._height)*(this.mHeight-this.adjScrollSize);
if(this.scroller._height>=this.mHeight){
this.scroller.spacer._height = this.mHeight-(this.adjScrollSize+this.distortSize);
this.scroller.spacer.enabled = false;
}
if(this.scroller.spacer._height>this.scroller.lines._height){
this.scroller.lines._y = (this.scroller.spacer._height/2)+(this.adjScrollSize/4);
}
else{
this.scroller.lines._visible = false;
}
this.scrollerPos = this._y;
this.initPos = this.attachTo._y;
this.moveHeight = (this.attachTo._height-this.mHeight)/(this.mHeight-this.scroller._height-(this.adjScrollSize/2));
this.scroller.bottom._y = this.scroller.spacer._y+this.scroller.spacer._height+this.scroller.bottom._height;
this.bg._height = this.mHeight-this.distortSize;
}
init_this();
Here is what I am using to connect the scrollbar to an object on the stage:
onClipEvent(load){
//THE SCROLLABLE OBJECT
this.attachTo = _root.txt_test;
//THE BACKGROUND FOR HTIS SCROLLABLE OBJECT - WE USE THIS FOR SIZE ADN SCROLL LENGTH REFERENCES
this.attachBG = _root.txt_test_bg;
}
And finally here is the script that I am using to get the scroll to content height ratios (scroll the content):
this.attachTo.onMyScroll = function(){
scrollerProp = scroller._y;
thisProp = Math.round((-scrollerProp*moveHeight)+initPos);
this._y = thisProp;
}
I would love to attach the full file, and will if anyone wants to see it; t is just to laarge to uploa here so I will wait until I have a request for the full fiel before uploading it.
I have looked at the Kirupa tutorial and that was able to help a little but I am now stuck again… Any and all help is much appreciated.
So thanks,
BetaWar
PS: There is additional AS code too, what is provided is only the scrolling code and init for the scrolling code. If you want to see the rest of the AS just ask.