How to play an animation with input?

Using blender, I created an animation of a swinging hammer. I imported it into unity and the preview looked great. When I dragged it in though, it did not ever work. I want to have it so that when the mouse is pressed, the animation will play once and cannot be played again until is has completely played. Is there a good way of doing this using Javascript?

Use this to call your animation, Place it on the object with the animation. The public var Swing must be set as your animation. I have not tested this script.

public var Swing : AnimationClip;

function Update(){


if(Input.GetMouseButtonDown(0)){

    	if (!animation.IsPlaying("Swing"))

			animation.Play("Swing");

    }

}