Hi guys I’m looking for a slick formula for easing a dynamic text field. If works fine for a text field placed on the main time line. Doesn’t matter what size the scrollbar is it still scrolls the loaded text top to bottom. But when I try to nest the text field and its assets within a movie clip I get some issues with large amounts of data being loaded. Seems to add whitespace at the top of the text area or cuts off some text at the bottom. I’ll post the code I have so far.
//scrollMC is the scroll bar handel
//text_area is text area container.
//scrollText is the text field
//bounds is the bounds for the scroll bar handel
/************************CODE FOR SCROLL EASING******************/
text_area.mask = _mask;
addEventListener(Event.ENTER_FRAME, scrollContent);
var _comp:Number = Math.abs(scrollMC.y);
var _scrollValue:Number = stage.stageHeight - bounds.height;
var _easeAmount:Number = 3;
//--EASE A TEXT FIELD
function scrollContent(e:Event):void {
var ty:Number = -((text_area.scrollText.height - stage.stageHeight) * ((scrollMC.y - _comp) / _scrollValue));
var dist:Number = ty - text_area.scrollText.y;
var moveAmount:Number = dist / _easeAmount;
if(text_area.height > _mask.height){
text_area.scrollText.y += (moveAmount);
}
}