animation doesn't work???

I recorded an animation of my weapon attacking, and it would play when the left mouse is pressed. now the animation worked, but it kept playing by itself even i checked off “Play Automatically”.
what is happening?
i did initialized it though.
my code:

#pragma strict

var thedamage : int = 50;
var Distance : float;
var MaxDistance : float = 1.5;
public var TheHammer : Transform;

function Update () 
{   if (Input.GetButtonDown("Fire1"));
	{
		TheHammer.animation.Play("attack");
		var hit : RaycastHit;
		if (Physics.Raycast (transform.position, transform.TransformDirection(Vector3.forward), hit))
		{
			Distance = hit.distance;
			if (Distance < MaxDistance)
			{	
				hit.transform.SendMessage("ApplyDamage", thedamage, SendMessageOptions.DontRequireReceiver);
			}
		}
	}
	if (TheHammer.animation.isPlaying == false)
	{
		TheHammer.animation.CrossFade("HammerIdle");
	}
}

You should set your WrapMode to only fire once. I believe it’d be something like this.

    TheHammer.animation["attack"].wrapMode = WrapMode.Once;
    TheHammer.animation.Play("attack");