# Height of a dynamic Text BOX? (After text load)

**URL:** https://forum.kirupa.com/t/height-of-a-dynamic-text-box-after-text-load/209929
**Category:** Uncategorized
**Created:** [December 13, 2006, 12:39pm UTC](https://forum.kirupa.com/t/height-of-a-dynamic-text-box-after-text-load/209929 "2006-12-13T12:39:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jpixels](https://avatars.discourse-cdn.com/v4/letter/j/6f9a4e/32.png) [@jpixels](https://forum.kirupa.com/u/jpixels)
#### Post date: [December 13, 2006, 12:39pm UTC](https://forum.kirupa.com/t/height-of-a-dynamic-text-box-after-text-load/209929/1 "2006-12-13T12:39:04Z")

</div>

Inside the contentMain movie clip:

//var myStyle:TextField.StyleSheet = new TextField.StyleSheet();  
[//myStyle.load](https://myStyle.load)(“sample.css”);  
//content\_txt.styleSheet = myStyle;

content\_txt.multiline= true;  
content\_txt.wordWrap = true;  
content\_txt.html = true;  
content\_txt.autoSize = true;  
mcback.\_height=content\_txt.\_height;

//var story:XML = new XML();  
[//story.ignoreWhite](https://story.ignoreWhite) = true;  
[//story.load](https://story.load)(“sample.html”);  
[//story.onLoad](https://story.onLoad) = function () {  
//content\_txt.htmlText = story;

```
//mcback._height=content_txt._height;

```

//}  
loadText = new LoadVars();  
loadText.load(“sample.txt”);  
loadText.onLoad = function() {  
content\_txt.htmlText = this.sampletext;  
mcback.\_height=content\_txt.\_height;  
content\_txt.autoSize = true;  
};

The text is still cutting off from the point of the initial dynamic text box size. The mcback movie clip is just something I put behind the text, as the easing scrollbar adjusts depending on the size (height) of the contentMain movieclip (which contains this code, the dynamic text box and mcback). Here is the easing scroller code:

scrolling = function (easing)  
{  
var moveSpeed:Number = 1;  
var easingSpeed:Number = 10;  
var scrollHeight:Number = scrollbg.\_height;  
// how much of the movie can be scrolled  
var scrollable:Number = contentMain.\_height-maskedView.\_height;  
var initContentPos:Number = contentMain.\_y;  
// the drag positions that are possible for the dragger  
var left:Number = scrollbg.\_x;  
var top:Number = scrollbg.\_y;  
var right:Number = scrollbg.\_x;  
var bottom:Number = scrollbg.\_height-dragger.\_height+scrollbg.\_y;  
contentMain.content\_txt.autoSize=true;  
contentMain.mcback.\_height=contentMain.content\_txt.\_height;  
// before we do anything make sure the content is even scrollable, if it isn’t hide everything and return  
if (scrollable\<0)  
{  
dragger.\_visible = false;  
btnUp.enabled = false;  
btnUp.\_alpha = 50;  
btnDown.\_alpha = 50;  
scrollbg.\_alpha = 50;  
btnDown.enabled = false;  
return;  
}  
// Updates the contents position  
function updateContentPos()  
{  
var percent\_scrolled:Number = (dragger.\_y-top)/(scrollHeight-dragger.\_height);  
// instead of setting the \_y property directly, we simple set newY  
// that way we can adjust how we handle the new Y coordinate we’d like to move to  
contentMain.newY = Math.round(initContentPos-(percent\_scrolled\*scrollable));  
}  
// here we will just always adjust to the position that we would like to move to…  
contentMain.onEnterFrame = function()  
{  
contentMain.mcback.\_height=contentMain.content\_txt.\_height;  
if (!easing || easing == undefined)  
{  
this.\_y = this.newY;  
}  
else  
{  
this.\_y += (this.newY-this.\_y)/easingSpeed;  
}  
};  
dragger.onPress = function()  
{

```
    startDrag(this, false, left, top, right, bottom);
    this.onMouseMove = function()
    {
        updateContentPos();
    };
};
dragger.onMouseUp = function()
{
    stopDrag();
    delete this.onMouseMove;
};
btnUp.onPress = function()
{
    this.onEnterFrame = function()
    {
        dragger._y = Math.max(top, dragger._y-moveSpeed);
        updateContentPos();
    };
};
btnUp.onDragOut = function()
{
    delete this.onEnterFrame;
};
btnUp.onRelease = function()
{
    delete this.onEnterFrame;
};
btnDown.onPress = function()
{
    this.onEnterFrame = function()
    {
        dragger._y = Math.min(bottom, dragger._y+moveSpeed);
        updateContentPos();
    };
};
btnDown.onRelease = function()
{
    delete this.onEnterFrame;
};
btnDown.onDragOut = function()
{
    delete this.onEnterFrame;
};
// makes the first update to scroll in case the user offset the dragger
updateContentPos();

```

};  
// here we pass in true to turn easing on, and false to leave it off  
scrolling(true);

Please help me!!! Please
