iPhone JavaScript behaves as if #pragma strict were set on normal Unity. Dynamic typing is disabled, which means everything becomes strongly typed. However, type inference still works. It’s important to understand the distinction. You can still do:
var someString = "hello";
var someVector = Vector3.Up;
These variables are strongly typed (to String and Vector, respectively), despite the fact that you didn’t specify their type. It happened implicitly. If it helps, you can optionally declare the types:
var someString:String = "hello";
var someVector:Vector3 = Vector3.Up
You’re probably getting tripped on on places where dynamic typing helps. Instantiate(), GetComponent(), Arrays, and so on all deal with more generic types. You can only put the most generic type, Object, into an Array or ArrayList, and GetComponent() returns a Component.
Take this:
var myRigidbody = GetComponent(Rigidbody);
What type is the myRigidbody variable set to? The answer isn’t Rigidbody; it’s Component! If you tried to use myRigidbody.velocity, you would get an error.
This is because GetComponent() needs to return the most generic type possible. All Rigidbodies are Components, but not all Components are Rigidbodies.
The answer here is to declare the variable type:
var myRigidbody:Rigidbody = GetComponent(Rigidbody);
This will attempt a cast.
…and if this doesn’t clear things up, just declare types on each and every variable