Animations not playing,Animations not working

i am making an FPS game, with the help of a tutorial on youtube
i got the code below to make my player have walk / idle animations.
they just dont play. no errors in the console.

using UnityEngine;
using System.Collections;

public class animManager : MonoBehaviour
{

public Animation am;
public AnimationClip walk;
public AnimationClip idle;

public Rigidbody rb;

void Update()
{

    if (rb.velocity.magnitude >= 0.1)
    {
        playAnim(walk.name);
    }
    else
    {
        playAnim(idle.name);
    }
}

public void playAnim(string animName)
{
    am.CrossFade(animName);
}

public void stopAnim()
{
    am.Stop();
}

}

I use unity 4.7 so i don’t know…but is “playAnim” a new thing? I I don’t see where the script recognizes what it means. If this script is on the gameObject with the animation I do like the sample below. As long as you have those animations listed in your Animation component the script will find them by name so no need to make each possible animation a public variable

Animation anim;

void Start(){
anim = GetComponent<Animation>();
}

//then to play a specific animation
anim.Play("walk");

//or 
anim.CrossFade("walk");

// OR AS I WOULD PUT IT IN YOUR SCRIPT//////////__________________________________________________________

 Animation anim;
 Rigidbody rb;
void Start(){
anim = getComponent<Animation>();
rb= getComponent<RigidBody>();
anim.Play("idle");
}
 void Update()
 {
     if (rb.velocity.magnitude >= 0.1)
     {
         anim.Crossfade("walk");
     }
     else
     {
         anim.Crossfade("idle');
     }
 }
// no need to actually stop  animation  - it will look like the game froze, just transition to an idle

well that seemed to work. thank u