load specific element of animation via var

Hallo, try to post my question in different way

maybe is better understood and will be answered

I will use this easy code, to activate all the animations of door, lift, and other who have two clip,

for exemple the door animation have OpenDoor and CloseDooor clips

the problem come when i try to load a specific clip from the door
in this way is called the first clip only. OpenDoor

 var animatedObj1 : GameObject; // Dooor
  var animatedObj2 : GameObject; // Button

 function Active()

I Try  

>> var AnimcCip : AnimationCilp;
to load specific clip OpenDoor or CloseDoor
and various way to do but not work at all or   
even  doesn't display any error loading the script
receive that's error when play 

NullReferenceException: Object reference not set to an instance of an object 

CameraRayReciver1.js(13,74): BCE0048: Type 'System.Type' does not support slicing.

if write directly the name of clip its work, but I need the var to reuse the script

Thanks to all can help my

You can load an animation using Animation.AddClip(yourClip,“nameOfClip”) or Animation.AddClip(yourClip, yourClip.name)

Given a clip you can do


thanks you

I’ve some trouble to use " Animation.AddClip "

but this answer put me on the way to do this

var animatedObj1  : GameObject; // Dooor at plane 0  
var animatedObj2 : GameObject; // Button
var animatedObj3 : GameObject; // Lift 
var animatedObj4 : GameObject; //Dooor at plane1 
     var anim1clip: AnimationClip ;   // Dooor at plane 0 close
     var anim3clip: AnimationClip ;// Lift go up
     var anim4clip: AnimationClip ;//Dooor at plane1 Open
 function Active()
      animatedObj2. animation.Play(); 
 yield WaitForSeconds (2);  //    time door is close
      yield WaitForSeconds (10); // time lift move


I’m not sure if is a good way but work!