下面code提出了一个明确的引用到值
在编译时:
The following code raises an ambiguous reference to value
at compile time:
import flash.display.Sprite;
public class Main extends Sprite
{
private var _value : Number = 0.;
public function get value() : Number { return _value; }
private function set value(v : Number) : void { _value = v; }
public function Main() : void
{
value = 42.;
}
}
我怀疑某种错误的编译器,虽然我并没有真正阅读的ECMA标准。
I suspect some kind of bug in the compiler, though I didn't actually read the ECMA standard.
在有人问这些问题:
在私人制定者也有意义。 的模糊性也与自定义命名空间的存在(这是我面临的问题)。这的确是在编译器中的一个错误,这是的在错误中列出的。它指出,开发商的一个oversite并不会很快修复任何时候。
it is indeed a bug in the compiler, and it is listed in the bugs. its stated that its an oversite of the developers and wont be fixed any time soon.
如果你需要专门跑一个函数来设置私有(而不仅仅是赋值,在这种情况下,你可以完全离开了setter函数和ITLL运行),那么你就必须运行一个单独的功能桑德罗说:
if you are needing to specifically run a function to set privately (rather than just assign the value, in which case you can leave out the setter function completely and itll run) then you will have to run a seperate function as Sandro said.