Hi Guys.
I have spent hours searching the forums for a solution to my autosize problem. What I have found in the forums, I have not been able to get to work for me.:puzzle:
I have a dynamic, scrollable text box with text loaded from external (.txt) source. The first text file has a link to the second text file, which opens up in the same box. I need the text box to autosize.
I am using Claudio’s scrollbar.
Here is the code for the scrollbar:
fscommand(“allowscale”, “false”);
bar.useHandCursor = dragger.useHandCursor=true;
space = 20;
friction = .9;
speed = 4;
speed = 4;
y = dragger._y;
top = main._y;
bottom = main._y+mask_mc._height-main._height-space;
dragger.onPress = function() {
drag = true;
this.startDrag(false, this._x, this._parent.y, this._x, this._parent.y+this._parent.bar._height-this._height);
dragger.scrollEase();
};
dragger.onMouseUp = function() {
this.stopDrag();
drag = false;
};
bar.onPress = function() {
drag = true;
if (this._parent._ymouse>this._y+this._height-this._parent.dragger._height) {
this._parent.dragger._y = this._parent._ymouse;
this._parent.dragger._y = this._y+_height-this._parent.dragger._height;
} else {
this._parent.dragger._y = this._parent._ymouse;
}
dragger.scrollEase();
};
bar.onMouseUp = function() {
drag = false;
};
moveDragger = function (d) {
if ((dragger._y>=y+bar._height-dragger._height && d == 1) || (dragger._y<=y && d == -1)) {
clearInterval(myInterval);
} else {
dragger._y += d;
dragger.scrollEase();
updateAfterEvent();
}
};
up_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, -1);
};
down_btn.onPress = function() {
myInterval = setInterval(moveDragger, 18, 1);
};
up_btn.onMouseUp = down_btn.onMouseUp=function () {
clearInterval(myInterval);
};
MovieClip.prototype.scrollEase = function() {
this.onEnterFrame = function() {
if (Math.abs(dy) == 0 && drag == false) {
delete this.onEnterFrame;
}
r = (this._y-y)/(bar._height-this._height);
dy = Math.round((((top-(top-bottom)*r)-main._y)/speed)*friction);
main._y += dy;
};
};
Here is the code for the text and autosize:
_parent.Box.main.maininfo.html=true;
_parent.Box.main.maintitle.html=true;
mylv = new LoadVars();
mylv.onLoad = function(success) {
if (success) {
_parent.Box.main.maininfo.htmlText=this.mainnursery;
_parent.Box.main.maintitle.htmlText=this.maintitle;
}
};
mylv.load(“mainnursery.txt”);
mylv.load(“mainTitle.txt”);
this.main.maininfo.autosize = “left”;
( I have two dynamic text boxes in this movie clip)
I am unable to upload a zip file it is too large.
Please help!
Thank you so much.