actionscript 3 - Assign function argument to global variable of the same name -
is possible set global variable within function takes same variable name argument?
var a:int = 0; function test(a:int) { *global* = *local*; } test(1); trace(a) // traces 0 i'd trace 1
(the reason why i'd this, avoid coming different variables names same things) in advance.
you refer explicitly this.a = a;
in function test
in case this
class instance holds variable. in case of static
variable, can use classname.a = a
.
Comments
Post a Comment