Var
Declaration
by ilyas usal
This is not a very important issue for small movies, but it is a good thing
to think about it.
Declaring a variable as var makes it local to the function in which it is
declared. Therefore it cannot be accessed from outside the function, and it is
destroyed at the end of each loop. So it is just a memory issue, but it can
become important on important projects.
function test ()
{
var i = 5;
trace (i);
}
test();
trace (i);
Hope this tutorial helped. If you have any
questions, please post them on the forums at
http://www.kirupa.com/forum/
|