# Scrolling dynamic movie clip

**URL:** https://forum.kirupa.com/t/scrolling-dynamic-movie-clip/200414
**Category:** Uncategorized
**Created:** [September 12, 2006, 1:09am UTC](https://forum.kirupa.com/t/scrolling-dynamic-movie-clip/200414 "2006-09-12T01:09:53Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![benny\_hill](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@benny\_hill](https://forum.kirupa.com/u/benny_hill)
#### Post date: [September 12, 2006, 1:09am UTC](https://forum.kirupa.com/t/scrolling-dynamic-movie-clip/200414/1 "2006-09-12T01:09:53Z")

</div>

I have a movieclip that loads dynamic news items from xml data, thus, the \_height of the movieclip is going to be variable. How would I set up a scroll bar that will scroll all the way down to very bottom of the movie clip but not be too short or go to far?

I can find the length of the dynamic movie clip by this script:

var scrollPaneHeight = (RootNode.childNodes.length) \* 160

160 is the heigth (including seperator) of each news item. For example the movie clip with 4 news items would end up with a \_height of 640.

I masked the movie clip and made a scroll bar graphic so the part I am confused on is the scrolling equation. I know how to setDrag and all of that but it seems that my scroll bar either scrolls to far or too short when I change the number of news items. I checked out all the tutorials I could find on kirupa and other sites but they seem way too involved for what I want to do and I wasn’t able to adapt the code.

Any help would be appreciated.
