function addScrollListeners():void {
right.addEventListener(MouseEvent.MOUSE_DOWN,start Scroll);
right.addEventListener(MouseEvent.MOUSE_UP, stopScroll);
left.addEventListener(MouseEvent.MOUSE_DOWN,startS croll);
left.addEventListener(MouseEvent.MOUSE_UP, stopScroll);
}
//handlers that either add or delete the scroll enterframe event
function startScroll(e:MouseEvent):void {
thumbMask_mc.addEventListener(Event.ENTER_FRAME, scrollThumbs);
}
function stopScroll(event:MouseEvent):void {
thumbMask_mc.removeEventListener(Event.ENTER_FRAME , scrollThumbs);
}
//the scrollThumbs function
//making it scroll left and right
function scrollThumbs(event:Event):void {
holder_mc.x += Math.cos((-thumbMask_mc.mouseX/scrollPaneWidth)*Math.PI)*scrollSpeed;
if (holder_mc.x>scrollPaneX) {
holder_mc.x=scrollPaneX;
trace("seft");
//above code controls left arrow
}
if (-holder_mc.x>(holder_mc.width-scrollPaneWidth-scrollPaneX)) {
holder_mc.x = -(holder_mc.width-scrollPaneWidth-scrollPaneX);
trace("right");
//above code controls right arrow
}
}