Proximity Sensor Limits

MAGIC_HAND.aia (1.7 MB)
I have uploaded one of the apps I am currently making and there seems to be a problem regarding the changing of the text box field. I want the value in the textbox to change as the distance between the phone and the object changes. But it remains stuck at "5".

And can anybody put some light on how does a proximity sensor work? Like do I have to turn off my lights in my room, or cover the whole screen of the phone?

If there are any mistakes in my code it would a great pleasure if someone could point them out.

I added an event counter.
My phone's sensor is almost totally unresponsive.

I got 5 once, 0 thereafter.