Play animations to different objects

Hi,
I would like to know how to apply animations to different objects.
Let’s say, there are ModelA which has no animations, and ModelB which has animations,
How do I apply ModelB’s animations to ModelA by script?
Thanks

First add the desired AnimationClip from B to A, and them play it

objA.animation.AddClip(objB.animation["anim01"].clip, "anim01");
objA.animation.Play("anim01");

If you want to add all the clips

for (var state : AnimationState in objB.animation) {
  objA.animation.AddClip(state.clip, state.name);
}

Thank you!