Scrollbar for the Timeline Issues

Hey folks. Problem I was wondering if you guys could help me with.

I’m trying to build a navigation system for a horizontal side scrolling website. To do that that, I’m trying to build a scroll bar that scrolls through the time line, as well as buttons that go to specific points. After modifying some examples I’ve found on these forums, I’m about 90% of the way there.

Problem is the scroll bar now. When I go to click on it and drag, it does scroll through the timeline, but the actual slider object (xSlider) remains in place. Any help to get the xSlider object to move appropriately would be greatly appreciated.

import flash.events.*;
import flash.display.MovieClip;
import flash.display.Shape;
import flash.events.MouseEvent;

	slide_mc.addEventListener(Event.ENTER_FRAME,slider);
	
		
		var xLine:Shape = new Shape();
        var xSlider:MovieClip = new MovieClip();

        function slider(e:Event):void {
		
			
            xLine.graphics.lineStyle(1, 0x666666);
            xLine.graphics.lineTo(400,0);
            xLine.graphics.endFill();
            xLine.y=50;
            addChild(xLine);

            xSlider.x=xLine.width/2;
            xSlider.graphics.lineStyle(1, 0x000000);
            xSlider.graphics.beginFill(0xFF6600, 1);
            xSlider.graphics.drawRoundRectComplex(0, 0, 10, 30, 20, 20, 20, 20);
            xSlider.graphics.endFill();
            xSlider.y=40;
            xSlider.buttonMode=true;
            addChild(xSlider);
			
		
		}
		
				
		xSlider.addEventListener(MouseEvent.MOUSE_DOWN,SliderDown);
		stage.addEventListener(MouseEvent.MOUSE_UP,SliderUp);

		
		function SliderUp(e:MouseEvent):void {
			stage.removeEventListener(MouseEvent.MOUSE_MOVE,StartDrag);
			}

		 
		 function SliderDown(e:MouseEvent):void {
			stage.addEventListener(MouseEvent.MOUSE_MOVE,StartDrag);
			}



		function StartDrag(e:MouseEvent):void {

			if (stage.mouseX>10&&stage.mouseX<xLine.width-20) {


				xSlider.x=stage.mouseX;

				this.gotoAndStop(Math.round(xSlider.x/10));
			}

		}