Shadowing fields with a local variable or with a function parameter is a bad practice that reduces code readability: It makes it confusing to know whether the field or the variable is being used.
class Foo {
public var myField:int;
public function doSomething():String {
var myField:int = 0;
...
}
public function doSomethingElse(myField:int):String {
...
}
}
Constructors and setters are exceptions; it is common practice to name arguments for the fields the values will be assigned to. Static methods are also ignored.
class Foo {
public var myField:int;
public function Foo(myField:int) {
this.myField = myField;
}
public static function build(myField:int):Foo {
...
}
public function setMyField(int myField):void{
this.myField = myField;
}
public function set myField(int myField):void{
this.myField = myField;
}
}