Help touch button

i have two animations “Idle” and “Play” when i touch the cell phone android button made in unity i have to keep pressed the button to play the animation. I want to play the animation with just one touch in the button. What is wrong with this script i need HEELP !

function Update () {
if(Input.touchCount >= 0)
{
var touch : Touch = Input.touches[0];

if(touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
{
    animation["Play"].speed= 1.0;
  animation.Play("Play");
  }
  else
  {
  	  animation["Idle"].speed= 1.0;
  animation.Play("Idle");


  	}

}
}

Animation.Play will play the animation from the first frame when it is called. If you call it every frame like that, it’ll never get past the first frame! Try putting in some kind of check to make sure you only play the animation once per touch.

The simplest solution goes a bit like this:

function Update () {
    if(Input.touchCount >= 0) {
        var touch : Touch = Input.touches[0];
        if(touch.phase == TouchPhase.Began)
        {
            animation["Play"].speed= 1.0;
            animation.Play("Play");
            ResetAnimation(animation["Play"]);
        }
    }
}

function ResetAnimation(curAnim : AnimationState)
{
    yield WaitForSeconds(curAnim.length);
    animation.Play("Idle");
}