walk crossfade run animation based on joystick position need help please

hi i working on my sidescroll game but i stuck on this problem, walk animation works fine but when my joystick position is bigger or smaller than 0.3 still playing walk animation

here is my script

var JoystickScript:Joystick;
var JoystickPos:Vector2;
var run:AnimationState;





function Start()
{
run = animation["run"];
run.layer = 1;
run.blendMode = AnimationBlendMode.Blend
}


function Update () {

JoystickPos = JoystickScript.position;


if (JoystickPos.x > 0.1){
animation.CrossFade ("walk");
} else if (JoystickPos.x < -0.1){
	animation.CrossFade("walk");
	
	
} else if (JoystickPos.x > 0.3){
	animation.CrossFade("run");
	
} else if (JoystickPos.x < -0.3){
	animation.CrossFade("run");


} else {
	animation.CrossFade("idle");

	}
}

This is a logic error: if JoystickPos.x > 0.1, the run condition is never tested - thus only idle and walk states are reachable.

Change the ifs to this:

var jPosX = Mathf.Abs(JoystickPos.x);
if (jPosX < 0.1){
    animation.CrossFade("idle");
}
else if (jPos < 0.3){
    animation.CrossFade("run");
}
else {
    animation.CrossFade("walk");
}