What's the matter with this script? Detect object dragging with iPhone Touch

The script dosn't work, why?? I can't understand. The script should detect if an object is dragged or not and print it in the GUIText.

static var dragging : boolean = false; // contains true if the object is dragged

function Update()
   for (var touch : Touch in Input.touches) {
      if (touch.phase == TouchPhase.Began) dragging = true;
      else if(touch.phase == TouchPhase.Ended) dragging = false;
   var targetText = GameObject.FindWithTag("txt");
   targetText.guiText.text = "is dragged = " + dragging;

You might find this tutorial useful:

I found the source code here: