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
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!