PlayerCasting.DistanceFromTarget; not working?

i have a button. i want to look at the button, and when only up close and when looking i want a UI message to appear on screen. here is my code:

import UnityEngine.UI;

var TextDisplay : GameObject;
var TheDistance : float = PlayerCasting.DistanceFromTarget;

function Update () {
    var TheDistance = PlayerCasting.DistanceFromTarget;
}

function OnMouseOver () {
    if (TheDistance <= 1) {
        TextDisplay.GetComponent.<Text>().text = "press Button";
    }
}

function OnMouseExit () {
    TextDisplay.GetComponent.<Text>().text = "";
}

but when i play, i see the UI “press button” whenever im looking at it and not just up close.
can anyone give me some advice on how my code should look and why? thanks for any replys.
UNITY4LIFE

You can see the TheDistance variable in the inspector of the Script on your target object.
What values does it show. Do the values make sense?
(for everyone that is wonding where “PlayerCasting.DistanceFromTarget” is comming from: )

i have tryed getting the value of a suitable distance with raycast and placing it into the Open Door 001 (Script) within the inspector wile my Switch001 is highlighted in the hierarchy but anything above a value of 2 or 2.0 sees to it that no ui shows up ever. and anything below 2 sees to it that the UI message shows up when looked at, no matter the distance.