I have a scrollbar, this charge some external text, but the trouble is the next. I charge different text in the same text box when i move the scroll to down and charge another text the scroll continue in the same position i left the last time. I need when i change the text this begging in the 0 position.
This is the code i used in the scroll.
function FNSCROLL(){
if(this.scrollText != undefined ){
if(this.scrollText.maxscroll==1){
if(this._visible) this._visible=false;
}
else{
if(!this._visible)this._visible=true;
}
this.slyder.clear();
this.slyder.lineStyle(1,0xFAC18A,100);
this.slyder.moveTo(0,0);
this.slyder.lineTo(0,this.scrollText._height-1);
this.rectwrapper._y=this.scrollText._height-this.rect wrapper._height;
if(this.pressUp){
if(this.scrollText.scroll>0){
this.scrollText.scroll-=1;
this.dragger._y = 10+int( (this.scrollText._height-30)*(this.scrollText.scroll-1) / this.scrollText.maxscroll );
}
}
if(this.pressDown){
if(this.scrollText.scroll<this.scrollText.maxscroll){
this.scrollText.scroll+=1;
this.dragger._y = 10+int( (this.scrollText._height-30)*(this.scrollText.scroll-1) / this.scrollText.maxscroll );
}
}
if(this.dragging){
var loc = this.dragger._y;
var yDragged = loc-10;
var newScroll = this.scrollText.maxscroll*yDragged /(this.scrollText._height-30);
this.scrollText.scroll=1+int(newScroll);
}
}
}
and this to charge the external texts
onClipEvent(load){
this.scrollText=_level0.myText1;
this.onEnterFrame=_level0.FNSCROLL;
}
I think so the answer is when i charge the text in the text box. But i not sure