How to define mouse click inside/outside a button area??

I made some buttons with GUI.button, each will popup a text from it
each button only popup by OnMouseDown() in each object’s trigger
something like,
Object01----> [BUTTON_01] ----> [TEXT_01]
Object02----> [BUTTON_02] ----> [TEXT_02]
Object03----> [BUTTON_03] ----> [TEXT_03]

my problem is, I want to hide the already active (BUTTON_01) when I click another Object…
but still able to click the BUTTON, to popup the [TEXT_01,
so, that’s the question. can I define whether if I click inside or outside the area of a button?

I can’t use a Rect, since the button is camera relative…
here’s my script:

public var Text : String = "text";
var boxWidth = 100;
var boxHeight = 50;
var position = 300;

public var ObjectName : String = "Object";
var isHighlighted : boolean = false;
var text1 : boolean = false;
var touchCam : WowCam;
var eyeCam : WowCam;

function OnMouseDown  () {

isHighlighted = true;

}

function OnGUI () {
var screenPos = Camera.main.WorldToScreenPoint (transform.position);
	if (isHighlighted) 
	{
		if (GUI.Button (Rect (screenPos.x-100,Screen.height-Camera.main.WorldToScreenPoint (renderer.bounds.max).y,200,30), ObjectName)) 
		{
				
				
				text1=true;
				isHighlighted = false;
				
			
		}
	}
	
	if (text1)
	{GUI.Box (Rect (position,Screen.height - 50,boxWidth,boxHeight), Text);}
	
if ((Input.GetButtonDown ("Fire1"))(isHighlighted==true))
{isHighlighted = false;}

if ((Input.GetButtonDown ("Fire1"))(text1==true))
{texOff();}
}

function Update () {
if ((touchCam.isTouching==true)||(eyeCam.isTouching==true))
{isHighlighted = false;
text1=false;
}
}

//function buttonOff(){
//buttonOn = false;
//}

function texOff() {
text1=false;
}

the Input.GetButtonDown make me can’t access the text inside it.
so I think I need it to identify whether I click inside/outside the button area.

any suggestion?
or perhaps enlight me with some logic about this? (+.+)

thanx before, sorry if I didn’t explain it right :slight_smile:

ahh… i forgot the OnMouseOver :smile:
problem solved… i hope