Problem with unity 5.1

Enter Vehicle_SingleAnimation.js(28,15;48,14;49,15;49,65 ): BCE0048: Type ‘UnityEngine.Component’ does not support slicing.

line 28: MyVehicle.animation[EnterExitVehicle.name].speed = 1;
line 48: MyVehicle.animation[EnterExitVehicle.name].speed = -1;
line 49: MyVehicle.animation[EnterExitVehicle.name].time = MyVehicle.animation[EnterExitVehicle.name].length;

Thanks for help:)

Maybe your answer is hidden here: Type 'Object' does not support slicing (error) - Unity Engine - Unity Discussions

or here: BCE0048: Type 'UnityEngine.Component' does not support slicing. - Questions & Answers - Unity Discussions

I try but not work for me

Can you show me the declaration for EnterExitVehicle and MyVehicle? Most likely you simply have to type it correctly. Dynamic typing in JS can save time, but it’s easy to break.

now this error is cone but now animation not work.
MissingFieldException: UnityEngine.GameObject.Animation on line 28

line 28: MyVehicle.Animation[“EnterExitVehicle.name”].speed = 1;