Character animation

I’m pretty new to Javascripting and unity. tried to watch tutorials and such, but I don’t understand how I can connect my script to change animation.

I got a Animator connected to my Player which is called Player.
Parameter (Int) → tore
idle = 0
run = 1

I tried this script but I get errors, I have also tried different scritps but I’m pretty stuck.
Any ideas?

#pragma strict
function Start () {
	private Animator animator;

function Update () {
//	var AT = gameObject.GetComponent(AnimateTexture);
	if (Input.GetKey ("a")) {
		animator.SetInteger("tore", 1);
	} else if (Input.GetKey("d")) {
		animator.SetInteger("tore", 1);
	} else {
		animator.SetInteger("tore", 0);

Since you’re writing Javascript, private Animator animator; is incorrect syntax. It also looks like you intend for it to be a global variable, but you declare it in Start. It should be this:

#pragma strict

private var animator : Animator;

function Start(){


function Update(){