Global parameter, Count int. how do i do that ?

I guess for some of you a pretty basic thing, but i don’t know how to do it.

i have Javascript A, and Javascript B.

within A i have a simple int parameter called countX
this count registers a event, and counts ++ for each time the event happens.

in script B, i want to be able to “read” the current value in A. And for example, be able to make it – (so it is also – in A)

can anyone help me out ?
thanx

In your B script put the following:

var aScript : AScript;

function Start() {
    aScript = gameObject.GetComponent.<AScript>(); // assuming both scripts are attached to the same GameObject
    if(!aScript)
       Debug.Log("Couldn't find ScriptA.");
}

And then wherever you want to reference countX, just put: aScript.countX.
Hopefully this helps.