Unity 3D 4.3.2 , animation.Play("name"); not working

First, the Unity 3D Hello guys , I liked the program that creates games :slight_smile: ! Come to that I have a problem , I saw a video of how to add weapons and etc , but I reached a point where I wanted to add an animation when the gun shot was fired , and edited the script etc , but the animation is not performed. Script I use :

https://dl.dropboxusercontent.com/u/99253328/Riffle.js

END OF CODE IS MORE LINE DO NOT PART OF THE SCRIPT

good, the animation of the firing of the bullet is not forfeit by Weapon tab Hierarchy has the Animation component , this is finally someone help me I am grateful , sorry for my bad english , I am Brazilian and I used the google translator to help me ! Images that might help you : http://imagizer.imageshack.us/v2/800x600q90/706/f5w3.jpg

try to use
animation.crossfade(“Name of animation”); or animation.play(“Name of animation”);

or else

OnMouseDown()
{
if(Input.GetMouseButtonDown(0)) {
       animation.Play("tiro", PlayMode.StopAll);           
       Instantiate(bala,transform.position,transform.rotation);
}


or

function OnMouseUpAsButton(){
 animation.Play("tiro");//, PlayMode.StopAll);           
       Instantiate(bala,transform.position,transform.rotation);
}

it could be that your animation is not marked as legacy, meaning that it was created in the animation editor but it could not be read by the animation component. or it may be the PlayMode.StopAll affecting it and also to point out you are setting the PlayMode of the animation to stop or stop all (don’t know what StopAll is used for). and why are you using the PlayMode.StopAll for? you can just use animation.Play("tiro");

I think that the animation function does just work in the Update