Drag translate object from raycast

I'm trying to access and then translate an object by using the mouse drag when the left mouse button is pressed. I need to use raycast to detect which object is selected to move. In this scene there is a gameobject called "myobject".

var SelectedObject : Transform;

function Update()
{
   //check if the left mouse has been pressed down this frame
    if (Input.GetMouseButtonDown(0))
    {
        //empty RaycastHit object which raycast puts the hit details into
        var hit : RaycastHit;
        //ray shooting out of the camera from where the mouse is
        var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        if (Physics.Raycast(ray, hit)){
            //print out the name if the raycast hits something
            Debug.Log(hit.collider.name);
            if (hit.collider.name == "myobject"){
            SelectedObject.Translate(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"),0);
            }
    }
}

Using this code, I see that the object is translating some of the time, but it jumps in an unpredictable way. Want I'm going for is a consistant motion. i.e. if you are holding the left mouse button and move up in y, then the onbject moves up in y as well. I feel that the problem I'm having has to do with the way that I am detecting the object each frame, but i don't know how to fix it.

You could put the Raycast and detecting part in a co-routine, set a boolean variable to true and then use something like this:

if (isDetected) {
  SelectedObject.transform.position.x += Input.GetAxis("Mouse X");
  SelectedObject.transform.position.y += Input.GetAxis("Mouse Y"); 
}