animation script help

Made a cannon and animated inside unity. it has a muzzle brake that moves backwards when fired. the animation works but i cant get the script to make it work in game play.
I need to have it play the animation when the w key is pressed down once. here is the script i.m trying to use any help would be appreciated.

function Update()
{
 if(Input.GetKeyDown("w"))
 {
  // Plays the reload animation - stops all other animations
  animation.Play("reload", PlayMode.StopAll);
 }
}

Maybe something like this will work:

var Anima : AnimationClip;

function Update() {

	if(Input.GetKeyDown(KeyCode.W)) {
 	
 		animation.Play(Anima.name);		
  		
	}
}

Based on the layers of your other animations this should play. If not, try adding this below the if statement

 animation[Anima.name].layer = 1; //adjust the number 1 higher if need be