import flash.geom.Rectangle;
class MyScrollbar
{
public var content:MovieClip;
public var viewable:Rectangle;
public var dragger:MovieClip;
public var track:MovieClip;
public var left:Number;
public var top:Number;
public var right:Number;
public var bottom:Number;
public var move_speed:Number = 0;
public var scrollable:Number = 0;
public var top_scroll:Number = 0;
public function MyScrollbar ()
{
left = track._x;
top = track._y;
right = track._x;
bottom = track._y + (track._height - dragger._height);
Mouse.addListener (this);
}
public function setContent (content:MovieClip):Void
{
this.content = content;
setScrollProps ();
}
public function setViewable (viewable:Rectangle):Void
{
this.viewable = viewable;
setScrollProps ();
}
public function setEasing (value:Boolean, speed:Number):Void
{
content.isEasing = value;
if (speed > 0 && value)
{
content.speed = speed;
}
}
public function updateContentPos ():Void
{
var percent_scrolled:Number = (dragger._y - track._y) / (track._height - dragger._height);
content.newY = Math.round (top_scroll - (percent_scrolled * scrollable));
}
public function setScrollProps ():Void
{
trace(“Hello”);
if (viewable == undefined || content == undefined)
{
return;
}
scrollable = content._height - viewable.height;
top_scroll = content._y;
initElements ();
checkScrollability ();
}
public function checkScrollability ():Void
{
if (scrollable < 0)
{
dragger._visible = false;
track._alpha = 0;
}
else
{
dragger._visible = true;
}
}
public function onMouseWheel (delta:Number):Void
{
var speed:Number = (delta > 0) ? move_speed : -move_speed;
dragger._y = Math.min (bottom, Math.max (top, dragger._y - speed));
updateContentPos ();
}
public function initElements ():Void
{
var src;
dragger.src = this;
track.src = this;
var newY;
var isEasing;
var speed;
content.speed = move_speed;
content.onEnterFrame = function ()
{
if (this.isEasing)
{
this._y += (this.newY - this._y) >> this.speed;
return;
}
this._y = this.newY;
};
dragger.onPress = function ()
{
this.startDrag (false, this.src.left, this.src.top, this.src.right, this.src.bottom);
this.onMouseMove = function ()
{
this.src.updateContentPos ();
};
};
dragger.onMouseUp = function ()
{
stopDrag ();
delete this.onMouseMove;
};
}
}
i just copied this code from the source and experiments, just want to ask for help on how can i change this so that the scrolling of the contents is much faster… also how can i change and remove the rectangle object and use the mask for scrolling in my movie:) thanks:)