I've used this as a door opening script:
How do I cancel the "hit.gameObject.animation.Play("Door_Open");" function after the animation been played?
asked Feb 09 '11 at 05:07 PM
A function can't be "canceled" from outside the function, but that's not necessary. Play() just starts the animation. With Stop() you can stop a running animation at anytime.
In your case it should be
answered Feb 09 '11 at 06:39 PM