3 Replies Latest reply on Oct 10, 2006 7:52 AM by kglad

# SCROLLBAR EQUATION

The relation of the

drag bar._y

with the

trackBar._height

and the

textfield.scroll

////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////
with what equation are you having trouble?

////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////
Hi there,

Could some one help me with an equation to scroll a textfield with a
scrollbar?

I'm combining a dynamic textfield with a typical scrollbar (btnUp, btnDrag,
btnBar, btnDown).

I know how to apply an equation to scroll an object with the _x or _y
property. But now I'm having big trouble apply an equation with the scroll
and maxscroll text properties.

Can any one help me?

Thanks

• ###### 1. Re: SCROLLBAR EQUATION
if you have a vertical trackBar and the registration points of dragbar and trackBar are at the top of those movieclips, you can relate the scroll property of your textfield to the position of your dragbar by solving the two equations (in 2 unknowns) below:

1=a*0+b
textfield.maxscroll=a*(trackBar._height-dragbar._height)+b;

or

a=(textfield.maxscroll-1)/(trackBar._height-dragbar._height);
textfield.scroll=Math.round(a*(dragbar._x-trackBar._x)+1)
• ###### 2. Re: SCROLLBAR EQUATION
Thanks allot... saved my life ;)

> if you have a vertical trackBar and the registration points of dragbar and
> trackBar are at the top of those movieclips, you can relate the scroll
> property
> of your textfield to the position of your dragbar by solving the two
> equations
> (in 2 unknowns) below:
>
> 1=a*0+b
> textfield.maxscroll=a*(trackBar._height-dragbar._height)+b;
>
> or
>
> a=(textfield.maxscroll-1)/(trackBar._height-dragbar._height);
> textfield.scroll=Math.round(a*(dragbar._x-trackBar._x)+1)
>

• ###### 3. Re: SCROLLBAR EQUATION
you're welcome.