# ScrollBar formula

**URL:** <https://forum.kirupa.com/t/scrollbar-formula/319202>\
**Category:** flash\
**Created:** [February 12, 2011, 1:28am UTC](https://forum.kirupa.com/t/scrollbar-formula/319202 "2011-02-12T01:28:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vfistri1](https://avatars.discourse-cdn.com/v4/letter/v/d2c977/32.png) [@vfistri1](https://forum.kirupa.com/u/vfistri1)\
**Post date:** [February 12, 2011, 1:28am UTC](https://forum.kirupa.com/t/scrollbar-formula/319202/1 "2011-02-12T01:28:07Z")

</div>

so i have some scrollbar(track and button) and some content.  
the formula i am using to calculate to calculate y of content is the following:  
[//contentStarting.y](https://contentStarting.y) and scrollbarButtonStarting.y are positions of sprites at the moment they are created  
content.y = -((contentStarting.y -scrollbarButtonStarting.y) +scrollbarButton.y) \* ((content.height- content.mask.height) / (scrollbarTrack.height - scrollbarButton.height));

this forumla works almost perfectly for me.  
the only problem i have is that i need to add extra space after content, so basically i want forumla to act as if  
content.height = content.height + extraSpace , but unfortunatelly setting the height scalesY, which is what i don’t want.  
only viabble sollution that i could came up with is to add some sprite at the end of content  
with alpha= 0 and height = extraSpace  
but that doesn’t seem like good sollution to me.  
So can som1 of you people good at “simple math” please update this forumula so it can work with extraSpace?
