# Scollbar mask

**URL:** https://forum.kirupa.com/t/scollbar-mask/45521
**Category:** Uncategorized
**Created:** [March 15, 2004, 3:17pm UTC](https://forum.kirupa.com/t/scollbar-mask/45521 "2004-03-15T15:17:08Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![massive3215](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/massive3215/32/253_2.png) [@massive3215](https://forum.kirupa.com/u/massive3215)
#### Post date: [March 15, 2004, 3:17pm UTC](https://forum.kirupa.com/t/scollbar-mask/45521/1 "2004-03-15T15:17:08Z")

</div>

Im trying to create a vertical scoll bar with a mask that reveals an image. I’m having some trould with the actionscript.

My FLA is here: [http://personal.bgsu.edu/~jimmel/dragimage.fla](http://personal.bgsu.edu/~jimmel/dragimage.fla)

My code inside my dragger looks like this:

//set intial ratio variable  
this.ratio=0 ;

//figure out widths of movieclips  
clipwidth = \_root.content\_mc.\_height;  
clipmask = \_root.mymask\_mc.\_height;  
//find placement of movieclip x position  
clipstart =\_root.content\_mc.\_y;  
//figure out percentage to move contents by so that  
//it scrolls the width of the mask correctly in relation  
//to the placement of the dragger  
percentage = (clipwidth - clipmask) / 100;

//drag code  
dragger.onPress=function(){  
//constrain dragger to line width  
this.startDrag(false,0,this.\_x,line.\_height,this.\_x);  
this.onEnterFrame=function(){  
//create a variable that returns a number ranging from  
//0 to 100 no matter what the length of line and  
//based on draggers position on that line  
ratio=Math.round(this.\_y\*100/line.\_height) ;  
//drag the content\_mc proportional to the size of  
// the mask and the position of the dragger  
\_root.content\_mc.\_y = (-(percentage \* ratio))+clipstart;  
}  
}  
//release code  
dragger.onRelease=dragger.onreleaseOutside=stopDrag;

Thanks for any help!
