dragging object horizontally only

hi. I'm looking for a script that would allow for horizontal drag (works just as a slider, only it is not GUI, but attached to game object). so you basically could click on an object, then drag it horizontally from min to max position..

here, in the example, we'd be able to drag the "playbutton" horizontally. but I think I messed the thing up.

 var TimeLine_PLAYBUTTON:Transform;

function Update(){

var focus:Transform;
function selectingFocus(){
    var hit:RaycastHit;
    var ray:Ray = Camera.main.ScreenPointToRay(Input.mousePosition);

    var tempFocus = focus; //last frame focus

    if(Physics.Raycast(ray, hit)){
        focus = hit.transform;
        focus= null;


var dragging = false;
function Select_and_drag(){
        //checking what did we click on
        //checking if that thing is a PLAYBUTTON
        if(focus == TimeLine_PLAYBUTTON)
                //if so, we drag the play button
                dragging = true;
    //if we lift the Mousebutton - we stop dragging the playbutton
        dragging =false;

function Drag(trans_dragged:Transform){
     var position_dragged = Camera.main.ScreenToWorldPoint(Vector3(Input.mousePosition.x, 0.0, 0.0));
     trans_dragged.position = position_dragged;
     //checking for end...
     if(!dragging) return;
     //...or loop

I'd use an OnGui method to check for a mouse drag event. You can apply Event.current.delta.x to the horizontal position of your object.