Animation to Stop after ran one time.

Hi, i have managed finally to animations run when i press a certain key.
My only problem is, that it only stops when i dont press the key anymore.
If i keep pressing the key, it plays animation over and over again, and i dont want to that happen. I want it to play it only once, and then again after i press the key again.
Heres my animation script… Its Javascript.

function Update(){
  animation["Attack"].speed = 2.5;

How can i prevent looping happening?

You can use


So the event only fire at the first instance the button is pressed.