During FITC this past weekend, I saw a presenter showing code such as:
var x, y:Number;
This innocent looking line may seem like declaring two variables x & y as the Number data type. However, what it actually does is declaring variable x with an undefined data type, and y as a Number.
To test, try this:
x = "";
Test movie, all is fine. No error message.
Now add this line:
y = "";
Test movie, and you’ll see the error message:
‘Type mismatch in assignment statement: found String where Number is required. y = “”;’
So remember to declare variables as intended, such as: