Variables in Flash 8 can be used without being defined. This will cause a mixture of global variables and local variables. errors may occur when used.
A global variable is not only a variable defined outside the function, but is also a global variable if the variable used in the function is not defined.
A local variable is a variable defined in a function. before using this local variable, you must use var. Otherwise, this variable is a global variable.
Assume that the followingCode:
Function Test(){For(I = 0; I <10; I ++ ){}}Test();Trace(I );
Variable I is used in the function, but is not defined, then I is a global variable, then trace (I) is shown as I = 10.
However, if the function has var I, I is a local variable, and trace (I) is undefined.
Conclusion,If you want to use a local variable, you must add var before the variable; otherwise, it is a global variable..