今天看到了这样的语句:
with(条件) {
语句;
...
}
以前没见过,有点奇怪。搜索中文居然没有解答,看来这个语句是相当基础了,可惜我真是不知,汗|||
用英文搜索找到了,原来这个语句可以帮助我们call一个对象一次,多次访问它的属性和方法。
例如:
theContent_txt.text = "the business is mine";
theContent_txt._x = 456;
theContent_txt._y = 345;
可以写为:
with(theContent_txt){
text = "the business is mine!";
_x =456;
_y =345;
}