Enemy plays "damage" animation then reverts to "idle"

How do you get an enemy to play an animation for one instant and then revert to a default animation?

I’ve tried CrossFadeQueued(“idle”) after calling the damage animation - doesn’t seem to work. Damage keeps on looping and idle is never played again… >.<

anim.wrapMode=WrapMode.Once;
anim.CrossFade ("Damage");

anim.CrossFadeQueued("idle");
anim.wrapMode = WrapMode.Loop;

Try something like this:

animation.CrossFade("hit");
for(;animation.isPlaying;)
yield;
animation.CrossFade("idle");

Try -

#pragma strict

private var z : int;

function Update () {

if (Input.GetKeyDown ("c")){
	z = (z % 2) + 1;
	if(z == 1){
		animation.Stop("Idle");
		walk();
	}else{
		idle();
	}
}

function idel(){
	animation["Idle"].wrapMode = WrapMode.Loop;
	animation.CrossFade("Idle");
}

function walk(){
    animation["Walk"].wrapMode = WrapMode.Loop;
	animation.CrossFade("Walk");
}

Or set a boolean when taking damage and do something like -

#pragma strict

var takingDamage : boolean;

function Update () {

if (takingDamage){
       animation.Stop("Idle");
       damage();
    }else{
       animation.Stop("Damage");
       idle();
    }
}

function idle(){
    animation["Idle"].wrapMode = WrapMode.Loop;
    animation.CrossFade("Idle");
}

function damage(){
    animation["Damage"].wrapMode = WrapMode.Loop;
    animation.CrossFade("Damage");
}