Different animations same button

hi,

i have different animations on one object. They are named: Select1,Select2,Select3,..... I want to choose between them with the same button. At start, the animation "Select 1" is playing. Now if i press the "d" key i want to skip to the next animation "select 2". If i press "d" another time it should switch to "select 3". Whenn i press "a" it should go back to "selection 2" and so on.

Is there a way to add a "+1" "-1" to a "animation.CrossFade" ? Like you would do with a "(Application.loadedLevel+1)" "(Application.loadedLevel-1)"

edit: (working script)

var anim = 1; // animation names start with '1' var maxAnim = 2; // make this as large as however many animations you have

function Update() { if (anim < maxAnim && Input.GetKeyDown("d")) anim++; if (anim > 1 && Input.GetKeyDown("a")) anim --; animation.CrossFade("Select "+anim); }

Keep track of them with some integer variable

var anim = 1; // animation names start with '1'
var maxAnim = 2; // make this as large as however many animations you have

Update()
{
   if (anim < maxAnim && Input.GetKeyDown("d")
     anim++;
   if (anim > 1 && Input.GetKeyDown("a")
     anim --;
   animation.CrossFade("Select "+anim);
}