how to access the animation of an object by another script attached to another object

I have an object a UIButton. the script he’s invoking is from the bullet object. I have a gunbarrel so when you click the button it will release a bullet and then the gun barrel will be animating. my question is, How can you access the animation of the gun barrel from the script invoke from the bullet object. So that when I click the button it create a bullet and at the same time the gun animated. Help PLEASE!

Well without seeing an example of your script it’s hard for me to determine exactly what you’re trying to achieve.

but I would of thought adding this to your script will do what you need:

var gunBarrel : GameObject;

//On click example
function OnMouseDown(){
	//Rename Fire Animation to the animation attached to the barrel
	gunBarrel.animation.Play("Fire Animation");
 }

Animation.Play : http://unity3d.com/support/documentation/ScriptReference/Animation.Play.html